I set some files using Paperclip expiring_url
. Those are working fine.
I try using CanCan 2.0 to allow expiring_url
only to signed members using the following code
# /app/models/ability.rb
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user
can :read, :movies
cannot :read, :movies, :expiring_url
if user.persisted?
can :read, :movies, :expiring_url
end
end
end
My MoviesController.rb
has load_and_authorize_resource
still all users are being able to download the movie.
expiring_url
is not an attribute of Movie
and I can see that is the reason why is not working. I'm not sure how can specify the paperclip expiring_url object associated to this in order to make it work.
Any idea how to do this?