Thursday, December 2, 2010

[Rails] Help understanding ActiveResource

I'm trying to better understand ActiveResource in Rails 3.

I have this Object that extends ActiveResource::Base, and when I use the
collection_path, and pass an argument to it, the returned URL has that
argument as params in the URL instead of creating the URL like in the
docs.

For example. The docs say

Post.collection_path #=> /posts.xml
Comment.collection_path(:post_id => 5) #=> /posts/5/comments.xml

Here is what I'm getting

Post.collection_path => /posts.xml
Comment.collection_path(:post_id => 5) #=> /comments.xml?post_id=5


I'm using Rails 3.0.1.

Thanks

~Jeremy

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate