Nevermind.. found what I need to search for. STI (Single Table
Inheritance).
Thanks!
On Mar 3, 1:59 pm, nateleavitt
<nateleav...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi Guys,
> I''ve tried searching for this, but haven''t come up with
the answers.
> Sorry, this is a basic question, so sorry for the newb-ness.
>
> Ok so I''m putting together a ruby report that uses ActiveRecord.
I
> will explain some details below:
>
> So I have an Payment object which inherits from ActiveRecord:
> Payment
> belongs to invoice
> id, invoice_id, amt, date, type
>
> Then I have 3 payment types; Initial, Recur, and Refund that inherit
> from Payment. The only differences are that each overrides the type
> field.
>
> So my question is this the correct way in setting this up... with only
> a payments table with a type field?
>
> I essentially want to do this: Initial.find(:all) and it will pull all
> payments with type Initial... instead of doing
> Payment.find(:all, :conditions...)
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---