I have a before_save
filter on my model class which sets a date field to a future date to guarantee the integrity of the data.
This works really well except with it comes to unit testing. I'd like to set up a test scenario which involves setting this date field to a date in the past. I can't do this using ActiveRecord
because the before_save
filter is called and the date is updated to a future date. Is the best way to do this to execute raw SQL using ActiveRecord::Base::connection.update
?