scope :visible, -> { where(:visible => true) }
- validates :title, :body, :presence => true, :invalid_chars => true
- validates :title, :length => 1..255
+ validates :title, :presence => true, :length => 1..255, :invalid_chars => true
+ validates :body, :presence => true, :invalid_chars => true
validates :latitude, :allow_nil => true,
:numericality => { :greater_than_or_equal_to => -90,
:less_than_or_equal_to => 90 }
validates :visible, :inclusion => [true, false]
validates :author, :associated => true
validates :event, :inclusion => %w[opened closed reopened commented hidden]
- validates :body, :length => { :maximum => 2000 },
- :invalid_chars => true
+ validates :body, :length => { :maximum => 2000 }, :invalid_chars => true
# Return the comment text
def body
has_many :old_ways
has_many :old_relations
- validates :title, :description, :invalid_chars => true
- validates :description, :presence => true
+ validates :title, :presence => true, :invalid_chars => true
+ validates :description, :presence => true, :invalid_chars => true
validates :description_format, :inclusion => { :in => %w[text html markdown] }
# this method overrides the AR default to provide the rich
scope :tagged, ->(t) { joins(:tags).where(:gpx_file_tags => { :tag => t }) }
validates :user, :presence => true, :associated => true
- validates :name, :presence => true, :length => 1..255
- validates :name, :description, :invalid_chars => true
- validates :description, :presence => { :on => :create }, :length => 1..255
+ validates :name, :presence => true, :length => 1..255, :invalid_chars => true
+ validates :description, :presence => { :on => :create }, :length => 1..255, :invalid_chars => true
validates :timestamp, :presence => true
validates :visibility, :inclusion => %w[private public trackable identifiable]