Pergunta

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?

Foi útil?

Solução

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top