On Thursday, May 21, 2015 at 6:58:35 AM UTC+1, Ruby Railhead wrote:
>
>
> Idea 3: Subclass ActiveRecord::Base (to say ActiveRecordLocal) and mix in 
> the modules mentioned above into this class. 
> Thoughts: This makes is clearer that when you're using ActiveRecordLocal, 
> you're not getting the stock ActiveRecord::Base behavior. Otherwise this 
> solution is identical to Idea 2.
>
>
Of the ideas you outline, I would either do this or:

- use SomeModel.record_timestamps = false to stop active record setting 
timestamps
- use before_save / before_create callbacks  (or override save) to set your 
own timestamps
- continue overriding transaction in order to get your start of transaction 
timestamp. 

The reason for this slightly different strategy is that it means you're 
only overriding public methods, so their api will remain stable (or at 
least go through the usual deprecation cycle) across versions of active 
record.

Fred 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/cdf1520a-29a2-48ce-bdfc-44145e64cdad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to