Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails mass assignment and Backbone.js

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?

like image 595
Yury Kaspiarovich Avatar asked Jan 23 '11 12:01

Yury Kaspiarovich


1 Answers

Answer From Backbone creator: http://www.quora.com/How-well-does-backbone-js-work-with-rails

like image 172
Yury Kaspiarovich Avatar answered Sep 30 '22 12:09

Yury Kaspiarovich