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

前端 未结 6 1965
灰色年华
灰色年华 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 18:53

    It should be noted that if you opt for the currently accepted answer (patching toJSON at the model level) you are affecting reading as well. Maybe that goes without saying, maybe not. But you will have a lot of work to do when rendering models/collections if you put this patch into affect in a backbone app. Therefore, I personally wouldn't use it as-is.

提交回复
热议问题