This project is archived and is in readonly mode.
ActiveResource - Adding associations through reflections
Reported by Markus Schwed | February 26th, 2011 @ 05:24 PM
Hello there,
Matthias Folz and I have added the 'has_many' and 'has_one' - associations through reflections in ActiveResource.
Now, It's possible to specify the class for a "Child-Resource" via :class_name - option in has_many and has_one - association definition.
We choosed the way through reflections, because in we plan to add some other cool features for associations like 'autoload' in ActiveResource.
For example:
GET /posts/123.xml delivers following response body:
<post>
<title>ActiveResource now have associations</title>
<content> ... </content>
<comments>
<comment> ... </comment>
<comment> ... </comment>
</comments>
</post>
has_many :comments, :class_name => ‘myblog/comment‘
Would resolve this comments into the Myblog::Comment class.
Greetz and thanks a lot for viewing this ticket!
Markus Schwed
Comments and changes to this ticket
-
Gaston Ramos March 1st, 2011 @ 09:10 AM
I have sent a pull request that add the same that your patch see: https://github.com/rails/rails/pull/70
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>