2013-05-03 30 views
0

我在尝试让骨干在保存时发送PUT请求到我的rails服务器时遇到问题。我不知道我在这里做错了什么,它是正确的GET请求只是不PUT ..主干没有发送PUT到服务器

这是我认为,我用来保存我的模型的代码。

e.preventDefault() 
$(@el).find('#error_explanation').html "" 
data = Backbone.Syphon.serialize(this) 
setError = false 
@model.set(data, error: (model, error) -> 
    setError = true 
) 
@model.save() 

任何帮助将不胜感激。

感谢,
待办事宜

回答

0

愚蠢的我....

这里是什么在我的模型。

validate: -> 
    console.log "validating" 
    console.log "options: #{options}" 
    errors = [] 
    if([email protected](@.get('email'))) 
    errors.push("Email can't be blank") 
    if([email protected](@.get('first_name'))) 
    errors.push("First name can't be blank") 
    if([email protected](@.get('last_name'))) 
    errors.push("Last name can't be blank") 

    return errors 

这实际上是当我试图保存它,我只是试图手动调用时调用。由于我没有返回正确的数据说它是有效/无效的,所以它总是无效。

哎呀...

待办事宜