Brandon,

I'm familiar with how STI works in Rails, and while you do make a good 
point, that could be handled by calling "set_table_name" in each of the 
4 AR models that are inheriting from the parent class. However, I'm 
trying to cut down on the code I write, and that wouldn't be cutting 
down at all. Another reason I think a module is the way to do this.

A plugin would work also, of course, but IMO a plugin is best suited for 
something that would be used and reused, where this is just a one off 
situation with literally no more than 4 models. It wouldn't take long to 
put a plugin together that does this, but I would probably never use it 
again... who knows though? I might.

Thanks for the pieces of advice everyone!

-- Josh
http://iammrjoshua.com

Brandon Keepers wrote:
> On Wed, Jan 14, 2009 at 4:04 PM, Joshua Abbott
> <[email protected]> wrote:
>> 1.) Create a new class that these 4 AR models would inherit from.
> 
> This won't actually work. Rails would try to use the same table to
> store all of the models if you inherit from one.  See the "Single
> Table Inheritance" section from
> http://api.rubyonrails.org/classes/ActiveRecord/Base.html
> 
>> 2.) Add a module to lib and include that in these 4 models.
> 
> If you don't go the plugin route (which I would probably recommend),
> this would be the way to go.
> 
> 
> --
> --------------------------------------------------------------------------------
> Training by Collective Idea: Ruby on Rails training in a vacation 
> setting
> http://training.collectiveidea.com � San Antonio, TX � Jan 20-23

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to