I''m using subdomain_fu successfully and generating subdomain routes
like this:
rotues.rb:
map.city_root '''',:controller => ''cities'',
:action =>
''index'', :conditions => { :subdomain => /.+/ }
using it in a view:
<%= link_to city.name, city_root_path(:subdomain => city.subdomain)%>
that works well, now I can''t figure out how to generate a nested route
with subdomain,
i.e. miami.site.com/users/1
trying any combination of the form user_path(@user,:subdomain =>
city.subdomain) does nothing excepnt append a parameter at the end of
the url like this:
site.com/users/1?subdomain=miami
help is greatly appreciated guys!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
andresmax-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Nov-24 15:03 UTC
Re: Subdomain fu woes
Found the fix, it is a bug with the subdomain_fu plugin. the solution may be found here http://www.portallabs.com/blog/2008/10/22/fixing-subdomain_fu-with-named-routes/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Nov 24, 2008, at 6:22 AM, andresmax-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> > I''m using subdomain_fu successfully and generating subdomain routes > like this: > > rotues.rb: > map.city_root '''',:controller => ''cities'', :action => > ''index'', :conditions => { :subdomain => /.+/ } > > using it in a view: > <%= link_to city.name, city_root_path(:subdomain => city.subdomain)%> > > that works well, now I can''t figure out how to generate a nested route > with subdomain, > i.e. miami.site.com/users/1 > > trying any combination of the form user_path(@user,:subdomain => > city.subdomain) does nothing excepnt append a parameter at the end of > the url like this: > > site.com/users/1?subdomain=miamiIn addition to the fix you found, you may also want to check out this patch. http://rails.lighthouseapp.com/projects/8994/tickets/1115-path-to-extend-named-routes-support-for-an-objects-to_params-method I wrote that because of a recent site I built with 18 subdomains and not wanting to write out all those links by hand. In your case above you could define a to_params method on User to return the hash (including the subdomain) and then just do user_path(@user) and it will do the right thing. Anyway, see the ticket for more info. -philip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---