I know it might sound like a stupid question, but for my index method in my record controller i dont want to return all objects of record, some logic is applied to determine which records are displayed depending on the user logged in.
Where would i keep such a method that would take the user as a paramater and return an array of the records to be displayed in the index method and how would it be called? in the controller?
so it would be something like
def index
@records = # get_records method would be called here
end
thanks
There’s no reason why you couldn’t (or shouldn’t) put that logic in the index method of the controller, such as: