2013-05-03 2 views
0

저장시 PUT 요청을 내 레일 서버로 보내려고 노력하는 중 문제가 발생했습니다. 내가 뭘 잘못하고 있는지 잘 모르겠다. 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() 

도움을 주시면 감사하겠습니다. 나
-do

답변

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 

이 코드는 실제로 수동으로 호출하려고 할 때 저장하려고 할 때 실제로 호출되었습니다. 올바른 데이터가 올바르지 않거나 유효하지 않다는 것을 반환하지 않았기 때문에 항상 유효하지 않았습니다.

어머 ...

-do