On 8 March 2010 21:03, Greg Ma <li...@ruby-forum.com> wrote:
> Hi,
>
> I have these 3 models:
> City :name
> Product :name
> city_preference :city_id, :product_id, :min, :max
>
>
>
> How do i create the associations between these tables?

Have a look at the rails guide on ActiveRecord Associations at
http://guides.rubyonrails.org.  Also Getting Started, Debugging and
the others if you have not already worked through them.

Also don't think about tables first, think about the real world
objects you are modeling and what there relationships and attributes
are.  That will then allow you to define the tables and associations.

Colin

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

Reply via email to