Feature: ActiveResource - Adding associations through reflections

70 views
Skip to first unread message

markusschwed

unread,
Feb 28, 2011, 11:16:07 AM2/28/11
to Ruby on Rails: Core
Hello everyone,

I'm new in contributing and i saw in the contributing-guides, that i
have to write an email at this list.
I hope, that's the right place for this. If it's not, i'M really
sorry.. ;)

Could someone please give me feedback about this lighthouse-ticket?
https://rails.lighthouseapp.com/projects/8994/tickets/6473-activeresource-adding-associations-through-reflections

It's about adding association-definitions in ActiveResource.

Thank you for reading this Mail.

Greetings
Markus Schwed

Antonio Tapiador del Dujo

unread,
Mar 1, 2011, 3:23:11 AM3/1/11
to rubyonra...@googlegroups.com
Hi Markus,

can associated records be created, using accepts_nested_attributes_for ?

That would be awesome!

markusschwed

unread,
Mar 1, 2011, 10:12:03 AM3/1/11
to Ruby on Rails: Core
Hi Antonio,

at the moment there is only the possibility to specify the class-name
for an associated resource via :class_name - option.

We added the association-definitions similar to the ActiveRecord-way
with own Reflection-classes, because we want to add some cool features
in the future.
Indeed, your idea with accepts_nested_attributes_for for create and
update is really good and could be on of these features to add.

Please visit the ticket, apply the patch and give feedback, that would
be very helpful.

Greetings
Markus


On 1 Mrz., 09:23, Antonio Tapiador del Dujo <atapia...@dit.upm.es>
wrote:
> Hi Markus,
>
> can associated records be created, using accepts_nested_attributes_for ?
>
> That would be awesome!
>
> El Lunes, 28 de Febrero de 2011 17:16:07 markusschwed escribió:
>
> > Hello everyone,
>
> > I'm new in contributing and i saw in the contributing-guides, that i
> > have to write an email at this list.
> > I hope, that's the right place for this. If it's not, i'M really
> > sorry..  ;)
>
> > Could someone please give me feedback about this lighthouse-ticket?
> >https://rails.lighthouseapp.com/projects/8994/tickets/6473-activereso...

mafolz

unread,
Mar 8, 2011, 2:54:22 AM3/8/11
to Ruby on Rails: Core
Hi

In fact, we would extend active resource with more restful features.
At the moment, a class-definition with has_many, has_one gives you the
posibility to have a resource with self associations.
For example: an Comment can have other comment and so on.

but for such a restful consume of a web service. a association over
id's isn't precice enougth.
we would build soon a resolver of link-tag in the data structure.

for exampple, a post has many comments, the classical way to define a
association is following:
GET posts/1.xml
<post>
..
</post>

GET posts/1/comments.xml
<comments>
<comment>
<post-id>1</post-id>
</comment>
</comments>

but you must have knowlege over the api server side. you must know the
url where you found the comments.
my prefered way for complexe api structures are link-tags like atom-
syndication-format.
GET posts/1.xm
<post>
<link type="comment" href="comments/1">
<post>

you don't need to know who the comments are, the posts gives his
associated objects.
every instance in restful apis should be selfdescribed.

summary, we would make activeresource smarter for the way, its consume
services and resolve associations and save performance.

at first, we would focus on this. smarter client usage is point two
for us masterplan :D

On 1 Mrz., 09:23, Antonio Tapiador del Dujo <atapia...@dit.upm.es>
wrote:
> Hi Markus,
>
> can associated records be created, using accepts_nested_attributes_for ?
>
> That would be awesome!
>
> El Lunes, 28 de Febrero de 2011 17:16:07 markusschwed escribió:
>
> > Hello everyone,
>
> > I'm new in contributing and i saw in the contributing-guides, that i
> > have to write an email at this list.
> > I hope, that's the right place for this. If it's not, i'M really
> > sorry..  ;)
>
> > Could someone please give me feedback about this lighthouse-ticket?
> >https://rails.lighthouseapp.com/projects/8994/tickets/6473-activereso...
Reply all
Reply to author
Forward
0 new messages