Rails Nested Resource Issues
Petr Blaho
pblaho at redhat.com
Fri Sep 21 08:13:51 UTC 2012
On Thu, Sep 20, 2012 at 01:20:41PM +0100, Martyn Taylor wrote:
> Gents.
>
> I'm having some trouble with getting nested resources working
> properly from bespoke XML/JSON in RESTful API. There seems to be
> some fundamental problems with the way rails works, which means we
> have to write a lot of bespoke code to get it working, possibly even
> having to monkey patch Rails itself.
>
> I've written an example rails app that highlights the problem and
> put a detailed description in the README you can find it here:
>
> https://github.com/mtaylor/Rails-Nested-Resource-Issues
>
> I've ran into this issue on IME. But it's going to affect us across
> all rails projects with REST APIs, so we could do with discussing
> this issue and coming up with the best possible solution that
> results in as little replication as possible.
>
> Please read through the problem and let me know if you have any
> better ideas that the solutions I have proposed.
>
> Regards
>
> Martyn
Hi,
I have already needed something similar in
https://github.com/aeolusproject/conductor/blob/master/src/app/controllers/providers_controller.rb#L238-247
Provider needs ProviderType id to be created but I do not like
<provider_type_id>42</provider_type_id> node in xml for input. I want
<provider_type><id>42</id></provider_type> or <provider_type id="42" />.
I have to parse incoming params too to make it work.
So I would propose to broaden this issue to include association ids as
well 'cause I think the solution can be the same.
With regrads
Petr Blaho
More information about the aeolus-devel
mailing list