Google Groups Home
Help | Sign in
Moderately complex case - what's the r_c way to handle this?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Greg Campbell  
View profile
 More options May 15, 2:34 pm
From: Greg Campbell <gtcampb...@gmail.com>
Date: Thu, 15 May 2008 11:34:03 -0700 (PDT)
Local: Thurs, May 15 2008 2:34 pm
Subject: Moderately complex case - what's the r_c way to handle this?
Here's the basic description of the domain I'd like to represent,
which has a few complications involved that I'm not sure how to
handle:

/locations/:id/resources/:resource_name/properties/:property_name/
values

A unique property can only be represented by the combination of
location id, resource name, and property name.  On the backend,
though, there are currently only three ActiveRecord models represented
by the full path above: a location model, a combined resource+property
model (which belongs_to a location), and a value model.  Thus, the
intermediate location/:id/resources path will be returning data that
doesn't directly map to an ActiveRecord model,  and the full parent
chain for values objects will be the equivalent of
locations.find(:id).resource_properties.find_by_resource_name_and_property_ name(res_name,
prop_name).values.

So: Does this require the deep nesting branch?  What items will need
to be tweaked in the resources, properties, and values controllers to
handle the model situation described above?   This is currently
planned to be a read-only API for accessing this data, so index and
show are the only two actions I need to support at the moment.

Apologies if I've missed some existing documentation that addresses
this kind of situation.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Golick  
View profile
 More options May 17, 11:17 am
From: "James Golick" <jamesgol...@gmail.com>
Date: Sat, 17 May 2008 11:17:00 -0400
Subject: Re: Moderately complex case - what's the r_c way to handle this?

You could use the deep nesting branch, and override tons of stuff.
But, my reccomendation, instead, would be to just override the collection
method (explained in the README) to do the find.

As long as the controller isn't polymorphic, and especially if you don't
need creation/updating, that's the easiest way to do it.

Hope that helps,

J


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google