How to make the f.select rails selected -


it's code:

<%= f.select :area, options_for_select([['a','a'],['b','b'],['c','c']]), {}, {:class => 'span3 controls controls-row'}, :selected => params[:area] %> 

and result is:

argumenterror in users#edit showing /home/airson/rails_projects/friends_of_local/app/views/users/edit.html.erb line #17 raised: wrong number of arguments (5 4) 

why.....@@?

no need use :selected pass params[:area] alone options_for_select second argument:

<%= f.select :area,      options_for_select([['a','a'],['b','b'],['c','c']], params[:area]),     {}, { :class => 'span3 controls controls-row' } %> 

the last value of params[:area] selected.

hope helps ; )


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -