Resources; how to rename nested url path?

Hi,

I’ve got some nested resources. I have a model called Feature, and
FeatureRelation. When I created the standard routes for nesting
(:has_many on Feature), I get a path like:

features/1234/feature_relations

What I’d like is:

features/1234/relations

Is this possible to do? I looked at the API and nothing jumped out at
me indicating it is?!

Thanks,
Matt

On 12/19/07, goodieboy [email protected] wrote:

features/1234/relations

Is this possible to do? I looked at the API and nothing jumped out at
me indicating it is?!

I don’t believe so with :has_many, but I think that dropping back to
less automation and do something like:

map.resource :features do | feature |
feature.resources :relations, :controller => “feature_relation”
end


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

See, I was going to say this but he might have many relations. Or he
could
just be really bad at naming objects.

This post (and others) is going to serve as the basis of my next
presentation. Thanks for the inspiration.

On Dec 20, 2007 3:19 PM, Bcp [email protected] wrote:

I’ve got some nested resources. I have a model called Feature, and
me indicating it is?!

Thanks,
Matt


Ryan B.
http://www.frozenplague.net

Instead of feature relation name it as relation

Sent from my iPhone

I have made a PATCH which would allow you to do just that…
http://dev.rubyonrails.org/ticket/10578

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs