Add a member to a pre-existing resource-route?

Rails2. If a route has already been established with “map.resources”,
is there any way I can add an additional member to it, without
over-writing what’s already there?

This comes up in two engines-style plugins interacting with each other
and with the app itself.

Jonathan R. wrote:

Rails2. If a route has already been established with “map.resources”,
is there any way I can add an additional member to it, without
over-writing what’s already there?

This comes up in two engines-style plugins interacting with each other
and with the app itself.

Just define the route as you normally would (with map.connect ).
map.resources is not magical; it’s just shorthand for a bunch of
map.connect statements.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Marnen Laibow-Koser wrote:

Jonathan R. wrote:

Rails2. If a route has already been established with “map.resources”,
is there any way I can add an additional member to it, without
over-writing what’s already there?

Just define the route as you normally would (with map.connect ).
map.resources is not magical; it’s just shorthand for a bunch of
map.connect statements.

Ah, i was worried that my second map.resources would ‘over-ride’ certain
things from the first one. But it looks like it doesn’t. If you call
map.resources once with certain :members, and then call it again with
another :member… it LOOKS like indeed all the aggregated members are
now there. Cool. Thanks.

Jonathan R. wrote:

Marnen Laibow-Koser wrote:

Jonathan R. wrote:

Rails2. If a route has already been established with “map.resources”,
is there any way I can add an additional member to it, without
over-writing what’s already there?

Just define the route as you normally would (with map.connect ).
map.resources is not magical; it’s just shorthand for a bunch of
map.connect statements.

Ah, i was worried that my second map.resources would ‘over-ride’ certain
things from the first one. But it looks like it doesn’t. If you call
map.resources once with certain :members, and then call it again with
another :member… it LOOKS like indeed all the aggregated members are
now there. Cool. Thanks.

Interesting to know. I’d tend to only call map.resources once and then
use map.connect, but it’s good to know that it works either way.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

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