Pay has 2 columns (methods) id and name
Wage has 3 columns id, pay_id and name
Pay is set up with:
has_many :wages
Wage is:
belongs_to :pay
First, I believe this is set up correctly , according to Rails idiom.
There are many wages that can be associate with a pay.
However in trying to map wage to pay I’m having a problem with this
line:
(This is an example line:)
<%= select ‘model’,‘category_id’, Model.find(@model.id).categories.map
{|x| [x.name, x.id]} %>
The use of ‘category_id’ and ‘categories’ I think is throwing me off.
How does category relate to my wage model ?
Your associations and assumptions between Pay and Wage are correct from
what
you originally posted. Can you post the actual RHTML code that is
suspect
here? I’m having a hard time understanding the situation here.
I’m just going to start this all over - cause I live on the ground
floor so jumping isn’t going to help. I’ve also looked at it every
which way and Sunday with no luck.
I’m looking at this
linkhttp://www.sciwerks.com/blog/2006/07/07/updating-select-controls-with-ajax/
where it is talking about KRJS plugin. Regardless my particular
question is not related to the plugin …yet.
The page is talking about updating a second select box based on the
choice user makes in first. It goes on to show an example view: