Design Question (Ruby On Rails)
In my system there are many types of users (4), based on the user that is logged in they have access to only certain information.

For example I am trying to do something like this in my Client model:
  
 

     class Client
         def self.allowed
            if current_user.is_a?(SuperAdmin)
              return self.all
            elsif current_user.is_a?(Client)
              return [current_user]
            elsif current_user.is_a?(ClientAdmin)
              return [current_user.client]
            end
          end
       end


The problem is, it seems my model doesn't have access to the current_user helper method.

I have 2 questions:
   

 1. How can I fix this
 2. Should logic such as getting back the allowed client be done in the model?


Design Question (Ruby On Rails)
===

In my system there are many types of users (4), based on the user that is logged in they have access to only certain information.

For example I am trying to do something like this in my Client model:
  
 

     class Client
         def self.allowed
            if current_user.is_a?(SuperAdmin)
              return self.all
            elsif current_user.is_a?(Client)
              return [current_user]
            elsif current_user.is_a?(ClientAdmin)
              return [current_user.client]
            end
          end
       end


The problem is, it seems my model doesn't have access to the current_user helper method.

I have 2 questions:
   

 1. How can I fix this
 2. Should logic such as getting back the allowed client be done in the model?

