Is there a way I can switch between to views at random for the root path?
root :to => 'pages#blue' or root :to => 'pages#red'
Thanks for any kind of help with this.
Is there a way I can switch between to views at random for the root path?
root :to => 'pages#blue' or root :to => 'pages#red'
Thanks for any kind of help with this.
You can pass a lambda as the value of :to
, so theoretically you could return two different responses randomly. It might be a better idea to swap the layout/view that's rendered though.
Edit
root to: lambda {|env| [ 302, {'Location'=> your_randomizing_code_here }, [] ]}
You could do that, or something very similar in your controller:
class YourRootController < ActionController::Base
def index
render some_method_that_returns_your_view_paths_randomly
end
end