Topic: Virtual attribute setter method in model, how to write a scoped query?
I have a form that has a virtual attribute 'contact_name'. In the setter method for this, I need to scope the query through current_user.contacts.find (etc). But current_user is a helper method (RESTful authentication) and it is apparently not available in the model (where the setter method is located). I tried..
@current_user = User.find(params[:user_id])
@contact = @current_user.contacts.find (etc)
.. but the params hash too is not available. How can I scope the query through the current_user in the model file?