문제

I have a Game model and I want to mass assign on create:

def create
game = Game.new(params[:game])
...
end

But Backbone sends model attributes without wrapping them in 'game' param, and I have to do this:

def create
game = Game.new(:title=>params[:title], ... )
...
end

I want my controller clean, how to use mass assignment with Backbone.js?

도움이 되었습니까?

해결책

다른 팁

This might help you from what I understand: https://gist.github.com/719080 (Not my code, gist by @trydionel).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top