Rails 2.0.2
I am trying to rewrite my app routes to follow a good RESTFul pattern in
the 2.0app version..
I have a single resource ''user'' and nested resource
map.resource :user, :controller => "users", :member =>
{:network =>
:get} do |user|
...
user.resources :relationships, :collection => {:network => :get,
:direct => :get, }
...
end
which is called by formatted_network_user_relationships for the
current user (logged in)
a dynamic network structure is built (xml format) and display by a flash
object
but writing this, it just give me the first level, clicking on a flash
''user'' object must call the relationships network for the
clicked user
something like formatted_network_users_relationships(:clicked_id)
to get
/users/<clicked_id>/relationships/network.xml
should I defined another resource ''users'' , or is this the
case for a
domain name ?
what kind of new route I should write ..
thanks
kad
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
> to get > /users/<clicked_id>/relationships/network.xml > > should I defined another resource ''users'' , or is this the case for a > domain name ? > > what kind of new route I should write .. > > thanks > > kadDon''t know if it''s the best one, but I found a solution, passing the clicked_id as a parameter, and using it in the controller so I have /user/relationships/network.xml?clicked_id= nnn -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You should use named route for this case. So if you want /users/<clicked_id>/relationships/network.xml define name route like this: map.network ''/users/:clicked_id/relationships'', :controller => ''your_controller'', :action => ''network'' when you do rake routes, you will see the URL helper method for this definition use that with the clicked_id as the parameter. On Dec 23, 2007 10:20 AM, Kad Kerforn <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Rails 2.0.2 > > I am trying to rewrite my app routes to follow a good RESTFul pattern in > the 2.0app version.. > > > which is called by formatted_network_user_relationships for the > current user (logged in) > > a dynamic network structure is built (xml format) and display by a flash > object > > but writing this, it just give me the first level, clicking on a flash > ''user'' object must call the relationships network for the clicked user > > something like formatted_network_users_relationships(:clicked_id) > to get > /users/<clicked_id>/relationships/network.xml > > should I defined another resource ''users'' , or is this the case for a > domain name ? > > what kind of new route I should write .. > > thanks > > kad > --- http://www.rubyplus.org/ Free Ruby Screencasts --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---