Revision: 36932
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 30, 2010 23:49 by garethhrees
Initial Code
class Product < ActiveRecord::Base validate :must_go_on_sale_before_event_starts # has scheduled_for datetime protected def must_go_on_sale_before_event_starts errors.add(:scheduled_for, 'should be before starts at') if scheduled_for > behaviour.starts_at || behaviour.starts_at < scheduled_for end end class Product::Event < ActiveRecord::Base # has starts_at datetime
Initial URL
Initial Description
Initial Title
Rails validate before save
Initial Tags
Initial Language
Rails