On Jan 13, 2008, at 6:21 PM, ara.t.howard wrote:

> a great example is
>
>   ApplicationModel < ActiveRecord::Base
>     before_save do |record|
>       record.updated_by = ApplicationController.current if
>         record.respond_to? 'updated_at'
>     end
>   end

Yes, custom macros would go there as well... it has use cases.


> which, of course, can be done in rails but only with a series of
> monkey patches.  do you really think it's clear to people a) how to
> do this, b) where it should go?  i really don't but maybe i'm just
> not rails-y enough.

I think it would be expected to emulate what's done with  
ApplicationController. That is, the rails generator would write

   app/models/application_model.rb

with something like

   class ApplicationModel < ActiveRecord::Base
     # Stuff common to your models comes here.
   end

and the model generator would output something like this

   class User < ApplicationModel
   end

Active Record would understand ApplicationModel is abstract as a hard- 
coded builtin assumption.

-- fxn


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to