form_for(@address) in form controller says undefined local variable 'address_params'

12 views
Skip to first unread message

fugee ohu

unread,
Apr 2, 2017, 4:42:54 PM4/2/17
to Ruby on Rails: Talk
Something in my routes? I'm using nested resources

resources :users do
  resources :addresses
end

Chris Vukin

unread,
Apr 3, 2017, 8:10:47 AM4/3/17
to Ruby on Rails: Talk
Being that you've got nested resources the form is looking for the @user info too, define the user in your address controller actions too and then pass it into your form like so: ([@user, @address]). That should get you on the right path. Try a Google of 'rails form_for nested resources' and see what you discover, happy exploring!
Reply all
Reply to author
Forward
0 new messages