On May 3, 2011, at 8:34 AM, none1 wrote:
> That was exactly what I was unaware of.
> 
> Documents can now be created by the form, but won't be shown. The js
> console gives this error:
> 
> Uncaught TypeError: Cannot read property 'id' of undefined

Can you paste in the Rails controller methods? It looks like 
DocumentsController#index, #create... You know what, can you paste in your 
entire DocumentsController?

> so I'm getting one step closer -- thank you very much Emmanuel.

You're welcome.

> The model now looks like:
> 
>    require 'dm-serializer'
>    class Document
> 
>        include DataMapper::Resource
>        include DataMapper::MassAssignmentSecurity
> 
>        property :id, Serial
>        property :title, String
>        property :body, String
> 
>        attr_accessible :body, :title
> 
>       #def to_json(options = {})
>       #  super(options.merge(:only =>
> [:id, :title, :created_at, :body]))
>       #end
> 
> end
> 
> - that to_json method still appears to do nothing I can detect (when
> uncommented)

The DocumentsController code will help clear this up.

> - going to /#documents/1
> 
>   produces an interesting:
> 
>   NoMethodError (undefined method `call' for "1":String):

Again, this is hard to interpret without a view of your controller code, and 
possibly the request params.

> I'll keep poking at it, thanks again.

Good luck, sounds like fun!

- Emmanuel

-- 
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.

Reply via email to