Tuesday, March 1, 2011

[Rails] Re: Rails guides has_many :through example

What are you trying to accomplish here? has_many :through setup
requires three tables. In this case it seems all you need is physician
has_many appointments.

class Physician < ActiveRecord::Base
has_many :appointments
end

class Appointment < ActiveRecord::Base
belongs_to :physician
end

And the phyicians and appointments tables will have the corresponding
name and datetime attributes.

-S

On Mar 1, 6:22 pm, zindelo <sh...@zindelo.com> wrote:
> Using the rails guides has_many :through example
> athttp://guides.rubyonrails.org/association_basics.html#the-has_many-th...
> , what is the best approach to writing the nested model form that would go
> with the example?
>
> Physician
> ==================
> Name:
>
> Physician Appointments
> ==================
> Patient Name:Appointment Date:

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate