Class: NewsPost

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/news_post.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.per_pageObject



19
20
21
# File 'app/models/news_post.rb', line 19

def self.per_page
  10
end

Instance Method Details

#check_dateObject



23
24
25
26
27
28
29
30
31
# File 'app/models/news_post.rb', line 23

def check_date
  if start_date and end_date
    self.end_date = end_date.end_of_day
    if start_date >= end_date
      errors.add(:start_date)
      errors.add(:end_date)
    end
  end
end