How to make the f.select rails selected
问题 It's my 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 where line #17 raised: wrong number of arguments (5 for 4) why.....@@? 回答1: No need to use :selected just pass your params[:area] alone to options_for_select as a second argument: <%= f.select :area, options