Welcome to mirror list, hosted at ThFree Co, Russian Federation.

location.rb « models « app - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e559442713d64874ddb116abcd0af2b2321f963d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

class Location < ApplicationRecord
  before_validation :split_coords, on: :create
  validates_presence_of :lat, :lng

  attr_accessor :coordinates

  include Diaspora::Federated::Base

  belongs_to :status_message

  def split_coords
    self.lat, self.lng = coordinates.split(',') if coordinates.present?
  end
end