Forum: Ruby on Rails Subdomains - redirect to different actions?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ben (Guest)
on 2006-01-05 22:03
(Received via mailing list)
Hey,
   I'm trying to figure out what the most elegant way to do this - I've
only got a small
amount of different  subdomains corresponding to categories -
 and I've been using fragment caching.

In particular, I was wondering what the best way to call these actions
is -
I'm thinking redirect and render_component aren't really very nice

I've also had to resort to my own naming of the fragments -
because the default fragment naming  includes the full host name
with the various subdomains.


def all
        unless read_fragment "post/all"
        @posts = Post.find(:all,:order=>"earliest DESC")
        end
end
.....
def index
        case @request.subdomains.first
          when "geek"
                render_component :action=>"geek"  #redirect_to
:action=>"geek"
          when "politics"
                render_component :action=>"politics"
          else
                render_component :action=>"all"
         end
end


Thanks,
Ben
This topic is locked and can not be replied to.