created item groups and link banners and their associations and fixed bugs with join tables

This commit is contained in:
Senad Uka
2015-03-22 06:17:05 +01:00
parent 38548e3e33
commit bbedb4a877
20 changed files with 219 additions and 81 deletions

View File

@@ -0,0 +1,16 @@
class LinkBanner < ActiveRecord::Base
belongs_to :category
belongs_to :section
belongs_to :sub_category
has_many :items
validates_presence_of :beginning, :ending, :image_url
validate :validate_beginning_before_ending
def validate_beginning_before_ending
if beginning && ending
errors.add(:ending, "End date must come after beginning date") if ending <= beginning
end
end
end