pretty sure you are wanting to have your private methods
AFTER public methods as that private dec makes everything
below it private... 

-ian

On 10:20 Wed 28 Apr     , Dan Sosedov wrote:
> Hello,
> 
> I found a really strange bug (or maybe not bug, not sure) in merb.
> 
> So, i have controller Settings which handles all user settings. But
> for different types of users (user, manager, admin) it supposed to be
> different. Settings pages are available for users only. For managers
> and admins it should redirect them to different route /admin.
> 
> so my controller looks like this:
> 
> class Settings < Application
>   before :ensure_authenticated
>   before :check_role
> 
>   private
> 
>   def check_role
>      redirect "/admin" if session.user.role != :user
>   end
> 
>   public
> 
>   def profile
>       .... logic ....
>   end
> 
>   ... all logic ...
> end
> 
> But for some reason page is not redirected there. In actions log
> (stdout) it shows that redirect header was triggered correctly: merb :
> worker (port 4000) ~ Redirecting to: /admin (302).
> Thus, other user types does not have any information to show on
> settings page and thats why instead of redirect im getting exception
> that user objects were not found (nils).
> 
> So, im really confused about such behavior of merb.
> 
> Any ideas why?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "merb" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/merb?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/merb?hl=en.

Reply via email to