Question

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?

Was it helpful?

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top