Reputation: 4603
I have this in the view ..
<%= simple_form_for @addr, :url => update_path, :method => :post do |f|%>
I have this in the routes
post 'update' => 'addresses/update'
I have this in the controller.
def update
@addr = Address.new
@addr = Address.find_by(user_id: spree_current_user.id)
@addr.update_attributes(getparams)
@addr.save
end
the thing is instead of making it go the create action, I am trying to make the form submit to the update action
edit:
this is the controllers name
AddressesController
this is the file name
addresses_controller.rb
this is the resource
resources :addresses
Upvotes: 0
Views: 138
Reputation: 644
Run rake routes
and make sure update_path exists. I think you need to define your route like this:
post 'update' => 'addresses#update', as: 'update'
Upvotes: 1