Bug in multiple map.resources :has_many?

Hi,

does map.resources accept more than one :has_many ?
there seems to be a path helper only for the last one (eg abc_bar_path)

map.resources :abc,
:has_one => :user,
:has_many => :foo,
:has_many => :bar

if so, is this a bug?

(the abc_user_path helper is not overwritten tho)

linoj

Hi –

On Mon, 13 Aug 2007, linojon wrote:

if so, is this a bug?

(the abc_user_path helper is not overwritten tho)

No, it’s not a bug. It’s because of how Ruby hashes work. The last
three lines are all key/value pairs in a hash. Since hash keys are
unique, you can’t have two :has_many keys, so the last one clobbers
the previous one.

David

/me slaps forehead

No, it’s not a bug. It’s because of how Ruby hashes work. The last
three lines are all key/value pairs in a hash. Since hash keys are
unique, you can’t have two :has_many keys, so the last one clobbers
the previous one.

So, use an array instead. :has_many => [:foo, :bar]


Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com