I’d like to always add a condition to any version of “find” (e.g.
Thing.find(), Thing.find_by_name(), Thing.find_by_whatever) so that in
addition to whatever conditions are set, an additional condition is set
I’d like to make sure that a user only sees/edits/creates entries in the
database that have the user_id field set to their id. I could wrap all
controller functions (create/new/show/edit/list) with
#note having to add to the “:conditions” field
@thing = Thing.find(params[:id],
render :text=>“I’m sorry, you do not have access to that record.”
…but clearly that is immensely un-DRY. AND, it removes the ability to
the helpful Thing.find_by_name/etc functions.
The goal is to make all versions of “find” work.
Is it possible to change one function in the model and make it work?
CTO, Eyetools Inc.
(916) 792 4538