I’ll try create a controler in towerjs, but I have an error while updating action:
TypeError: Property 'id' of object #<Object> is not a function
Here how looks my action:
update: ->
App.User.find @params.id (error, user) =>
user.updateAttributes @params.user, (error) =>
if error
@render "edit", locals: user: user
else
@render "show", locals: user: user
Console shows me that id parameters is passed:
Parameters:
{ user:
{ name: 'admin',
email: 'example@domain.com',
password: '21232f297a57a5a743894a0e4a801fc3' },
id: '4faa6c614b2ce49b34000001',
action: 'update',
format: 'html' }
more info:
The identical actions are built in show, edit, destroy and they are working.
All actions uses the same _form partial.
This code:
is equivalent to this:
so you’re trying to call
@params.idas a function and passing your(error,user) =>function to@params.idas its argument. I think you want to pass@params.idand(error,user) =>toApp.user.findas two arguments so add a comma: