Save method does return false
ilyakatz opened this issue · 0 comments
ilyakatz commented
Looks like validates_timeliness
has some issues when using SimpleDelegator. save
method doesn't return false if validation fails. I'm not entirely sure if this is a general validation issue or specific to this gem. Here is the how to reproduce
class EventFormObject < SimpleDelegator
include ActiveModel::Validations
validates_date :start_at,
:end_at,
:on_or_after => lambda { Date.current }
def initialize(event)
super
end
end
irb(main):087:0> e = Event.last; ef = EventFormObject.new(e);
=> 1
irb(main):088:0> ef.save
=> true
irb(main):089:0> ef.valid?
=> false