This project is archived and is in readonly mode.

#6473 new
Markus Schwed

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

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>

People watching this ticket

Attachments

Pages