nathanvda/on_the_spot — Issue #26: Couldn't find User with id=update_attribute_on_the_spot
Author: TvL2386
Created: 2011-10-17 17:48:06+00:00
State: open

Hi,

I've tried your example but it does not seem to work...
It tries to pass "update_attribute_on_the_spot" as the user_id...
Am I doing something wrong? Here's my code:

# views/users/profile.html.haml:
Email: #{on_the_spot_edit @user, :email}

# controllers/users.rb
```
def update
@user.attributes = params[:user]

if @user.save
flash[:notice] = "User was succesfully updated."
redirect_to users_path
else
render :action => 'edit'
end
end

def profile
@user = current_user
end
```

```
Started PUT "/users/update_attribute_on_the_spot" for 127.0.0.1 at 2011-10-17 19:42:05 +0200
Processing by UsersController#update as HTML
Parameters: {"value"=>"tom@vleeuween.eu", "id"=>"update_attribute_on_the_spot", "authenticity_token"=>"zGEByLj0CCyz4xUbdt+/GqjNnerJDj8fp5rzG1tWB5Y="}
User Load (0.4ms) SELECT `users`.* FROM `users` WHERE `users`.`auth_token` = 'k-KM4BqSE4wUXmqEhNrARg' LIMIT 1
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 0 LIMIT 1
Completed 404 Not Found in 25ms

ActiveRecord::RecordNotFound (Couldn't find User with id=update_attribute_on_the_spot):
```