Materialize: Rails + Materialize: select doesn't select proper "selected" option

Created on 1 Mar 2015  路  2Comments  路  Source: Dogfalo/materialize

Using Materialize in my Rails 4.2 app, and having a problem with select to show proper "selected" option after form has been saved.

I've checked logs and variable does get saved.

I've tried:

<%= f.select :state, options_for_select(apply_us_states, :selected => params[:state]) %>

and also tried

<%= f.select :state, options_for_select(apply_us_states, params[:state])%>

Select works and shows options as it should, but won't select previously saved value.

Most helpful comment

Nvm, got it sorted out.

This is what i had to do:

<%= f.select :state, apply_us_states %>

apply_us_states is a helper

hope this helps someone else

All 2 comments

Nvm, got it sorted out.

This is what i had to do:

<%= f.select :state, apply_us_states %>

apply_us_states is a helper

hope this helps someone else

Can we see the helper you used for the options?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

acierpinski picture acierpinski  路  3Comments

locomain picture locomain  路  3Comments

hartwork picture hartwork  路  3Comments

PhillippOhlandt picture PhillippOhlandt  路  3Comments

samybob1 picture samybob1  路  3Comments