I'm working through a basic demo of a backbone.js (derived from
http://www.jamesyu.org/2011/01/27/cloudedit-a-backbone-js-tutorial-by-example/).
All examples I've found work with Activerecord.
It is very basic, but doesn't work when I recreate it using DM. I'm
new to js, but from what I can see the js is working but I haven't set
DM and rails to talk properly with the json coming from the browser:
The controllers below:
class DocumentsController < ApplicationController
def create
21--> document = Document.create! params
render :json => document
end
end
Submitting a post to create:
Processing by DocumentsController#create as JSON
Parameters: {"title"=>"asdfasdf", "body"=>"asdfadsfs"}
Completed in 1ms
ArgumentError (The attribute 'action' is not accessible in Document):
app/controllers/documents_controller.rb:21:in `create'
If I create objects through the console, they don't get rendered
either and there is js errors indicating not being able to read the
response correctly.
I've found next to nothing about backbone/dm and I'm new to js/json.
I'd like to be able to move what I'm doing into more of an ajax
context, and found backbone.js to be something I can understand. The
post doesn't give anything I'm accustomed to from a regular form (e.g.
params[:document], but I haven't toyed with the form template itself
yet hmmmm). Do I need to work with dm-serializer, there is something I
need to do to the model, etc.?
example application here:
https://[email protected]/blueblank/dmbackbone-example.git
Any input appreciated. I'd like to be able to work this out and have
others be able to reference.
--
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en.