Advertisement
Guest User

Untitled

a guest
Mar 12th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 1.31 KB | None | 0 0
  1. # In a view I'm trying to get a username representation for users instead of the user_id:
  2.  
  3. <div class="field">
  4.     <%= f.label :user_id %>
  5.     <%= f.text_field :user_id, options_for_select( User.all.map{ |u| [u.username, u.id] }, params[:user_id] ) %>
  6.   </div>
  7.  
  8. """
  9. When I do this, I get this error:
  10.  
  11. Showing /home/hseritt/dev/ruby/events/app/views/events/_form.html.erb where line #36 raised:
  12.  
  13. undefined method `merge' for #<ActiveSupport::SafeBuffer:0x007f36fc34ece0>
  14. Extracted source (around line #36):
  15. 34
  16. 35
  17. 36
  18. 37
  19. 38
  20. 39
  21.              
  22.   <div class="field">
  23.     <%= f.label :user_id %>
  24.     <%= f.text_field :user_id, options_for_select( User.all, params[:user_id] ) %>
  25.   </div>
  26.  
  27.   <div class="actions">
  28.  
  29. Trace of template inclusion: app/views/events/edit.html.erb
  30.  
  31. Rails.root: /home/hseritt/dev/ruby/events
  32.  
  33. Application Trace | Framework Trace | Full Trace
  34. app/views/events/_form.html.erb:36:in `block in _app_views_events__form_html_erb___1052964315614350465_69937071727060'
  35. app/views/events/_form.html.erb:1:in `_app_views_events__form_html_erb___1052964315614350465_69937071727060'
  36. app/views/events/edit.html.erb:3:in `_app_views_events_edit_html_erb___71126088508495426_69937071917140'
  37. Request
  38.  
  39. Parameters:
  40.  
  41. {"id"=>"1"}
  42. Toggle session dump
  43. Toggle env dump
  44. Response
  45.  
  46. Headers:
  47.  
  48. None
  49.  
  50. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement