Backbone.js and Rails - How to handle params from Backbone models?

前端 未结 6 1969
灰色年华
灰色年华 2021-02-01 18:38

In a standard Rails controller, I\'d create a record like this:

@user = User.new(params[:user])

This assumes that the form parameters that come

6条回答
  •  执念已碎
    2021-02-01 19:06

    If you are using the backbone-rails gem, looks like you can do

    var User = Backbone.Model.extend({
       paramRoot: 'user'
    });
    

    Around line 45 on github

    Credit PL J and stream 7 on this link

提交回复
热议问题