I''m pretty new here, but if anybody had ideas on how to go about using subdomains for accounts within Rails 2.2. I had seen the subdomain-fu plugin, but it didn''t look like it plays very well with 2.2. Anyone know of other plugins that might be useful? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The code to configure this is fairly trivial, try something like this in the controller(s) you need subdomain access. before_filter :load_account def load_account @account = Account.find(:first, :conditions => ["slug = ?", request.subdomains.first]) raise ActiveRecord::RecordNotFound unless @account end On Dec 3, 10:16 am, Perry D <perrydeg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m pretty new here, but if anybody had ideas on how to go about using > subdomains for accounts within Rails 2.2. I had seen the subdomain-fu > plugin, but it didn''t look like it plays very well with 2.2. Anyone > know of other plugins that might be useful?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That''s awesome. I put that code into my application.rb file and it seems to work great! In addition, I am looking to a couple of other subdomains not attached to accounts (ie- admin.domain.com). I installed the request_routing plugin and it seems to work great. It gives me some good options within the routes.rb file that allow me to direct the root of the application to different controllers based on the subdomains. Like this: map.root :controller => ''public_home'', :action => ''index'', :conditions => { :subdomain => '''' } map.root :controller => ''public_home'', :action => ''index'', :conditions => { :subdomain => ''www'' } map.root :controller => ''system'', :action => ''index'', :conditions => { :subdomain => ''admin'' } map.root :controller => ''account_home'', :action => ''index'', :conditions => { :subdomain => /.+/ } This seems to work great with Rails 2.2. On Dec 3, 12:19 pm, Andrew Bloom <akbl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The code to configure this is fairly trivial, try something like this > in the controller(s) you need subdomain access. > > before_filter :load_account > def load_account > @account = Account.find(:first, :conditions => ["slug = ?", > request.subdomains.first]) > raise ActiveRecord::RecordNotFound unless @account > end > > On Dec 3, 10:16 am, Perry D <perrydeg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m pretty new here, but if anybody had ideas on how to go about using > > subdomains for accounts within Rails 2.2. I had seen the subdomain-fu > > plugin, but it didn''t look like it plays very well with 2.2. Anyone > > know of other plugins that might be useful?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, Im looking to implement user based subdomains and catch-all routes into my app. Can subdomain-fu do this? I followed Ryan Bates'' railscast on this but he does not go into dynamically added subdomains and routes. Can any of you point me to some resources for getting started on this? Thanks! On Dec 4, 6:32 pm, Perry D <perrydeg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> That''s awesome. I put that code into my application.rb file and it > seems to work great! > > In addition, I am looking to a couple of other subdomains not attached > to accounts (ie- admin.domain.com). I installed the request_routing > plugin and it seems to work great. It gives me some good options > within the routes.rb file that allow me to direct the root of the > application to different controllers based on the subdomains. Like > this: > > map.root :controller => ''public_home'', :action => ''index'', :conditions > => { :subdomain => '''' } > map.root :controller => ''public_home'', :action => ''index'', :conditions > => { :subdomain => ''www'' } > map.root :controller => ''system'', :action => ''index'', :conditions => > { :subdomain => ''admin'' } > map.root :controller => ''account_home'', :action => > ''index'', :conditions => { :subdomain => /.+/ } > > This seems to work great with Rails 2.2. > > On Dec 3, 12:19 pm, Andrew Bloom <akbl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > The code to configure this is fairly trivial, try something like this > > in the controller(s) you need subdomain access. > > > before_filter :load_account > > def load_account > > @account = Account.find(:first, :conditions => ["slug = ?", > > request.subdomains.first]) > > raise ActiveRecord::RecordNotFound unless @account > > end > > > On Dec 3, 10:16 am, Perry D <perrydeg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I''m pretty new here, but if anybody had ideas on how to go about using > > > subdomains for accounts within Rails 2.2. I had seen the subdomain-fu > > > plugin, but it didn''t look like it plays very well with 2.2. Anyone > > > know of other plugins that might be useful?--~--~---------~--~----~------------~-------~--~----~ 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 was the plugin I used. http://github.com/veilleperso/request_routing/tree/master On Dec 5, 12:56 am, Ram <yourstruly.vi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Im looking to implement user based subdomains and catch-all routes > into my app. Can subdomain-fu do this? I followed Ryan Bates'' > railscast on this but he does not go into dynamically added subdomains > and routes. Can any of you point me to some resources for getting > started on this? > Thanks! > > On Dec 4, 6:32 pm, Perry D <perrydeg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > That''s awesome. I put that code into my application.rb file and it > > seems to work great! > > > In addition, I am looking to a couple of other subdomains not attached > > to accounts (ie- admin.domain.com). I installed the request_routing > > plugin and it seems to work great. It gives me some good options > > within the routes.rb file that allow me to direct the root of the > > application to different controllers based on the subdomains. Like > > this: > > > map.root :controller => ''public_home'', :action => ''index'', :conditions > > => { :subdomain => '''' } > > map.root :controller => ''public_home'', :action => ''index'', :conditions > > => { :subdomain => ''www'' } > > map.root :controller => ''system'', :action => ''index'', :conditions => > > { :subdomain => ''admin'' } > > map.root :controller => ''account_home'', :action => > > ''index'', :conditions => { :subdomain => /.+/ } > > > This seems to work great with Rails 2.2. > > > On Dec 3, 12:19 pm, Andrew Bloom <akbl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > The code to configure this is fairly trivial, try something like this > > > in the controller(s) you need subdomain access. > > > > before_filter :load_account > > > def load_account > > > @account = Account.find(:first, :conditions => ["slug = ?", > > > request.subdomains.first]) > > > raise ActiveRecord::RecordNotFound unless @account > > > end > > > > On Dec 3, 10:16 am, Perry D <perrydeg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I''m pretty new here, but if anybody had ideas on how to go about using > > > > subdomains for accounts within Rails 2.2. I had seen the subdomain-fu > > > > plugin, but it didn''t look like it plays very well with 2.2. Anyone > > > > know of other plugins that might be useful?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---