ga-wdi-exercises / project2

[project]
1 stars 30 forks source link

Drop down list #842

Closed fanelenan7 closed 7 years ago

fanelenan7 commented 7 years ago

I'm having troubles getting a drop down list to work. It appears, all the options are fine, I can make a selection and save, but the changes don't stick. It doesn't re-assign my stuff to where I selected.

  <%= f.label "Assign to Album" %>
  <%= f.collection_select :album_id, Album.order(:title),:id,:title, include_blank: true %>

tried this too, with no result

 <%= f.label "Assign to Album" %>
 <%= f.select :album, options_for_select(@albums.map{|a| [a.title, a.id]}) %>
amaseda commented 7 years ago

What does your controller action look like? If you use create! or update! (depending on what this is a form for), do you get an error?

fanelenan7 commented 7 years ago

update! gave me nothing.

amaseda commented 7 years ago

What information is coming in through the form (i.e., what is stored in params)? If you don't see this in the terminal, try placing puts params at the top of your update action and see what the output is in the terminal.

fanelenan7 commented 7 years ago

Ohhhh params would not permit album_id. Fixed :) thanks Adrian!

amaseda commented 7 years ago

:+1: