Okay, Thiagocifani and others interested,

I have finally revised the structure of my application for plural table 
names, which already existed,  and singular model names.  Across tables I 
have set up parent and foreign key with exactly the same field name and 
data type.  Within models I have defined belongs_to and has_many.  

Now I am revisiting my views, in the case where the child value is a single 
value to the parent, the display is working fine.   What I am finding 
challenging is populating <select   

The parent is advertiser, and the child is category..

Currently I have:

    <label>Advertisement Category:</label>
    <% @categories = Category.find(:all, :readonly => true, :order=> 
"category_type") %>
    <% @cats = options_from_collection_for_select(@categories, 
:category_id, :category_type) %>
    <%= nf.select( :category_id, @cats) %>

How do I rewrite this?  From the controller, how should I set up my data 
source?  Tried includes and Parent.child.find

Thanks,

Liz

 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/dd097137-c98e-4af9-869a-e9e0c30206a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to