gates
gates

Reputation: 4603

Routing error, uninitialized constant Addresses

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

Answers (1)

Milos Blasko
Milos Blasko

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

Related Questions