On 13 February 2012 03:11, Everaldo Gomes <everaldo.go...@gmail.com> wrote:
>
> because I didn't understand very well what are you doing.

I'm trying to do:

in route.rb I have: match "/:layout" => "companies#index"

Then when I call localhost/intraOp ther params[:layout] is "intraOp",
when I call localhost/interOp the params[:layout] is "interOp".
In application_controller I set:

before_filter :set_layout, :authenticate_user!  #(authenticate_user is
from devise gem)

def set_layout
   if params[:current_layout] == "intraOp"
     session[:current_layout] = :intra
   elsif params[:current_layout] == "interOp"
     session[:current_layout] = :inter
   else
     session[:current_layout] = nil
   end
   @current_layout = session[:current_layout]
 end
end

Then I have @current_layout set to "intraOp" or "interOp", if neither
intraOp or interOp is set then @current_layout is nil.
In application_controller I have also before_filter :set_layout,
:authenticate_user!.
In companies_controller I've set skip_filter  :authenticate_user!,
only[:index, :show] but I want not to skip if @current_layout is nil.

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to