Sunday, February 12, 2012

Re: [Rails] what's wrong?

On 12 February 2012 11:22, Mauro <mrsanna1@gmail.com> wrote:
> On 12 February 2012 12:14, Colin Law <clanlaw@googlemail.com> wrote:
>> On 11 February 2012 23:46, Mauro <mrsanna1@gmail.com> wrote:
>>> route.rb
>>>
>>> match "/:layout" => "company@index"
>>>
>>> in application_controller I have:
>>>
>>> before_filter :authenticate_user!
>>>  rescue_from DeviseLdapAuthenticatable::LdapException do |exception|
>>>   render :text => exception, :status => 500
>>>  end
>>>  protect_from_forgery
>>>  before_filter :set_layout
>>>
>>>  layout :specify_layout
>>>
>>>  def specify_layout
>>>    if @current_layout == :intra
>>>     "intranet"
>>>   elsif @current_layout == :inter
>>>     "internet"
>>>   else
>>>     "application"
>>>   end
>>>  end
>>>
>>>  def set_layout
>>>   if params[:layout] == "intraOp"
>>>     session[:current_layout] = :intra
>>>   elsif params[:layout] == "interOp"
>>>     session[:current_layout] = :inter
>>>  else
>>>   session[:current_layout] = nil
>>>  end
>>>   @current_layout = session[:current_layout]
>>> end
>>> end
>>>
>>> in another controller I have:
>>>
>>> skip_filter :authenticate_user!, :only => [:index, :show] unless
>>> @current_layout.nil?
>>>
>>> unless condition seem does not work.
>>> What I am missing?
>>
>> Is it possible that your before_filter .. unless test is being run
>> before set_layout is called?   You could display some debug output to
>> find out.
>
> Sorry for my ignorance, how can I display some debug?

Have a look at the Rails Guide on Debugging, it shows several techniques.

Colin

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate