Re: [Rails] Re: what's wrong?
On 12 February 2012 18:59, Matt Jones <al2o3cr@gmail.com> wrote:
>
>> skip_filter :authenticate_user!, :only => [:index, :show] unless
>> @current_layout.nil?
>>
>> unless condition seem does not work.
>> What I am missing?
>
> The unless will run at class-definition time, not on each request. It
> also runs in the context of the class, not the instance - so
> @current_layout will *always* be nil.
>
> To do conditional activation of callbacks, try the :if or :unless
> options. These take either a symbol representing a method or a proc.
I've tried
skip_filter :authenticate_user!, :only => [:index, :show] :unless =>
lambda {@current_layout.nil?}
But does not work.
--
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