Newbie on rails, need some help :D

Bohdan Pohoriletz wrote:

Try <%= f.select(:part1, {List::NAME, List::TYPE})

<%= collection_select(:post, :user_id, User.all, :id, :name) %>

Thanks, neither of these exactly worked the way I wanted them, but it did help me with googling what I was looking for.

For the first one, I just kept the same code, but added in the controller

params[:list][:full] = params[:list][:part1] + " " + params[:list][:part2] right before @list = List.new(params[:list])

in the create method.

All of the creating stuff works perfectly now, but I'm having trouble with edit.

The drop down Name list is already picking the right name, which is good, but the other one isn't.

Right now, the code is:

  <%= f.select(:part1,List::NAME,{}, {:size=>5}) %>   <%= f.select(:part2,List::TYPE,{}, {:size=>5}) %>

Each select has 5 options, so I opted to just use a select field instead of a drop down. I tried adding :selected=>"Ruby" to the first one, but it didn't do anything. I believe that the current values which should be defaulted can be found by full.split(" ")[0] and [1], but not really sure how to implement that here.

Thanks again for the response =) I think I'm starting to get a better feel for this.