Hello- I''m giving RESTful development a shot. I''m running into some difficulty with controller I have grouped into modules. Specifically, I have a "admin" module with a "user" controller (created with "generate controller admin/user"). I managed to get map.resources wired up with this code: map.resources Admin::User, :path_prefix => "/admin" I''m not sure if that''s the right way, but it seems to work. The problem I''m running into is with setting up my link_tos. I tried this code: <%= link_to ''Show'', user_path(@user) %> Which failed with a "undefined method `user_path'' for #<#<Class:0x47eaa14>:0x47ea9ec>". Not unexpected. However I can''t figure out the right syntax for the path to my user admin actions. Can anyone help? Regards- Eric -- 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 -~----------~----~----~----~------~----~------~--~---
Look at namespace
map.namespace :admin do |admin|
admin.resources :users
end
gives you helpers such as this:
<%= link_to ''Show'', admin_user_path(@user) %>
also look at the very useful:
rake routes
Eric Marthinsen wrote:> Hello-
>
> I''m giving RESTful development a shot. I''m running into
some difficulty
> with controller I have grouped into modules. Specifically, I have a
> "admin" module with a "user" controller (created with
"generate
> controller admin/user"). I managed to get map.resources wired up with
> this code:
>
> map.resources Admin::User, :path_prefix => "/admin"
>
> I''m not sure if that''s the right way, but it seems to
work. The problem
> I''m running into is with setting up my link_tos. I tried this
code:
>
> <%= link_to ''Show'', user_path(@user) %>
>
> Which failed with a "undefined method `user_path'' for
> #<#<Class:0x47eaa14>:0x47ea9ec>". Not unexpected. However
I can''t figure
> out the right syntax for the path to my user admin actions. Can anyone
> help?
>
> Regards-
> Eric
--
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
-~----------~----~----~----~------~----~------~--~---
map.namespace :admin do map.resources :users end admin_user_path(@user) should do the trick. On Jan 29, 2008 5:35 PM, Eric Marthinsen <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hello- > > I''m giving RESTful development a shot. I''m running into some difficulty > with controller I have grouped into modules. Specifically, I have a > "admin" module with a "user" controller (created with "generate > controller admin/user"). I managed to get map.resources wired up with > this code: > > map.resources Admin::User, :path_prefix => "/admin" > > I''m not sure if that''s the right way, but it seems to work. The problem > I''m running into is with setting up my link_tos. I tried this code: > > <%= link_to ''Show'', user_path(@user) %> > > Which failed with a "undefined method `user_path'' for > #<#<Class:0x47eaa14>:0x47ea9ec>". Not unexpected. However I can''t figure > out the right syntax for the path to my user admin actions. Can anyone > help? > > Regards- > Eric > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, Here is a perfect 2.0 RESTful nested and namespace tutorial, after checking u would totally understand the whole stuff. I am not doing ad here. cuz it really needs to recommend :) http://www.akitaonrails.com/2007/12/12/rolling-with-rails-2-0-the-first-full-tutorial On 1月29日, 上午9时05分, Eric Marthinsen <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello- > > I''m giving RESTful development a shot. I''m running into some difficulty > with controller I have grouped into modules. Specifically, I have a > "admin" module with a "user" controller (created with "generate > controller admin/user"). I managed to get map.resources wired up with > this code: > > map.resources Admin::User, :path_prefix => "/admin" > > I''m not sure if that''s the right way, but it seems to work. The problem > I''m running into is with setting up my link_tos. I tried this code: > > <%= link_to ''Show'', user_path(@user) %> > > Which failed with a "undefined method `user_path'' for > #<#<Class:0x47eaa14>:0x47ea9ec>". Not unexpected. However I can''t figure > out the right syntax for the path to my user admin actions. Can anyone > help? > > Regards- > Eric > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
This is great info. Exactly what I waslooking for. Thanks.
Regards-
Eric
--
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
-~----------~----~----~----~------~----~------~--~---