ruby on rails - Params sent are not the same in a backbone's model -


In the application of a simple spinal cord, I have this model:

  class Rcbvm2.Models item increases backbone. Model Initialize: (ModelName) - & gt; @ ModelName = modelName @paramRoot = @modelName @urlRoot = "http: // localhost: 3000 / # {@modelName}"   

When I try: < Pre> items = new Rcbvm2.Models.Item ('pages') item.set ('body', 'test') item.id = 2 item.save ()

Therefore, a request is sent to my rail application with this request:

  get started "for" 127.0.0.1 "/ pages / 2" 2012-11-01 19:39: Processing page controller # 40 -0400 as the # JSON parameter: {"pages" => {"silent" => true}, "body" = & gt; "test", "id" = & Gt; "2", "page" = & gt; {"Body" => "test"}}   

OK, it works My problem is when I do this:

  items = new RCBVM 2. Model. Item (name) // Model Name Item. Set ('Body' 'Test'). Change the item .id = 2 item.save ()   

I have it:

  for PUT "/ news / 2" 127.0.0.1 2012-11 -01 19:40:04 -0400 Update by NewsController # Updated as JSON parameter: {"News" = & gt; {"Silent" = & gt; Truth}, "body" = & gt; "Test1", "id" = & gt; "2"}   

As you can see, the "body" in the hash is "new".

Edit 1

with the page I have this "page" = & gt; {"Body" = & gt; "Test"} , with news, nothing is ...

EDGE END 1

I also used the model " Users ", a model which is not present in my Rail application and it seems the same as compared to the news.

I do not undestand do you have any ideas?

Edit

These are my paths:

  Resources: Page Resources: News  < / Pre> 

The only thing for both.

I think everything is correct, the problem is that you have to return the correct JSON to your News Controller Look at your page controller, and compare it with your news controller.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -