Why can't I do this on my Model
class Abc < ActiveRecordBase
def before_save ActiveRecord::Base.record_timestamps = false end
def after_save ActiveRecord::Base.record_timestamps = true end
end
ABC.save! throws errors without telling me what the problem is. There are timestamps in this particular table and I don't want them to be auto-populated by Rails.
ActiveRecord::RecordNotSaved: ActiveRecord::RecordNotSaved from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/base.rb:2206:in `save_without_validation!' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/validations.rb:911:in `save_without_dirty!' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/dirty.rb:83:in `save_without_transactions!' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/transactions.rb:110:in `save!' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/connection_adapters/abstract/database_statements.rb: 66:in `transaction' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/transactions.rb:79:in `transaction' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/transactions.rb:98:in `transaction' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/transactions.rb:110:in `save!' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/transactions.rb:118:in `rollback_active_record_state!' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/ active_record/transactions.rb:110:in `save!' from (irb):18