I've got a Rails 3.1 app using CanCan 1.6. I'm protecting a variety of attributes with attr_protected ... :as => :api
. I'd like to use load_and_authorize_resource
, but also to strip off the protected fields. Any ideas?
EDIT: Here's my current workaround:
In orders#new, I'm skipping the load_resource
and just authorizing. I initialize the new order directly, with the appropriate scope:
@order = Order.new(params[:order], :as => :api)
Then setting the user manually:
@order.user = current_user
Certainly not a huge deal to do, but less elegant than just letting CanCan load and authorize natively, as I'm doing elsewhere.