josh
#1
Hi all
I have a model called “party_organisator” connected to its controller
PartyOrganisatorsController.
I’m switching to RESTful routes, so I’m having
map.resources :party_organisators
My “problem” is: I have to point my browser to
localhost:3000/party_organisators
to access it, but I’d like to access it using
localhost:3000/parties/organisators
How can I do this? I’m a bit unsure with the options I can use… :-/
Thanks
Josh
josh
#2
I think you might try:
map.connect ‘party/
organisator’, :controller=>‘party_organisator’, :action=>‘index’
(Look at the comments at the top of your routes.rb file.)
On Dec 18, 4:08 pm, Joshua M. [email protected]
josh
#3
Paul L. wrote:
I think you might try:
map.connect ‘party/
organisator’, :controller=>‘party_organisator’, :action=>‘index’
(Look at the comments at the top of your routes.rb file.)
On Dec 18, 4:08 pm, Joshua M. [email protected]
I doubt that this is what I’m looking for - I need map.resources, not
map.connect, don’t I?!
josh
#4
There’s no such word as “organisators”, so I’m using organisers.
Assuming parties and organisers are two different controllers:
map.resources :parties do |party|
party.resources :organisers, :name_prefix => “party_”
end
and the other way
map.resources :organisers do |organiser|
organiser.resources :parties, :name_prefix => “organiser”
end
If you’re using Rails 2.0 you should be able to do something like this:
map.resources :parties, :has_one => :organiser
map.resources :organiser, :has_many => :parties
On Dec 19, 2007 8:36 AM, Joshua M.
[email protected]
wrote:
I doubt that this is what I’m looking for - I need map.resources, not
map.connect, don’t I?!
Posted via http://www.ruby-forum.com/.
–
Ryan B.
http://www.frozenplague.net