Undefined method "merge" for "test": String - Rails 3.1
I have a collection_select:
<%= form_for(@feedback) do |f| %> <div class="field"> <%= f.label :poster_id %><br /> <%= f.collection_select :feedback, :poster_id, @users, :id, @user.username, :prompt => "Select your username" %><br /> <%= f.number_field :poster_id %> </div> <% end %> This error message is:
ActionView::Template::Error (undefined method `merge' for "test":String): 15: 16: <div class="field"> 17: <%= f.label :poster_id %><br /> 18: <%= f.collection_select :feedback, :poster_id, @users, :id, @user.username %><br /> 19: <%= f.number_field :poster_id %> 20: </div> 21: <div class="field"> app/views/feedbacks/_form.html.erb:18:in `block in _app_views_feedbacks__form_html_erb__3181571289116259961_2154876620' app/views/feedbacks/_form.html.erb:3:in `_app_views_feedbacks__form_html_erb__3181571289116259961_2154876620' "test" is the username returned by @user.username .
How to fix it?
+4
2 answers
signature for collection_select:
def collection_select method, collection, value_method, text_method, options = {}, html_options = {} I'm not sure what you are trying to do, maybe this is what you want:
<%= f.collection_select :poster_id, @users, :id, :username, :prompt => "Select your username" %><br /> +11