I’m new to rails so this may be obvious, but…
I want to implement a simple owner-based authentication system. Every
(there are different types of item) in the system has a field owner_id
is a foreign key to the user table. A user has permission to edit an
they own the item.
So to check if a user owns an item I can do something like:
item.user_id == session[:user_id]
Is there an easy way to enforce this across the whole system? Can I
implement this as a filter? Can I pass an argument to a filter i.e. the
that is being checked, or will I need to put it in the session?
All help is greatly appreciated.