In my ability.rb
, I have the following rule:
elsif user.has_role? :demo can :read, Profile, demo_featured: true, demo_linked: true, message: "To access this profile, please subscribe here."
But this does not create the message I want.
How do I get this particular rule to create the message I want?
Change 1
Here is the complete ability.rb
if
condition:
def initialize(user) user ||= User.new
These are some bits from my ProfilesController
:
before_action :set_profile, only: [:show, :edit, :update, :destroy, :invite_user, :profiles] def set_profile @profile = Profile.published.includes(:grades, :positions, :achievements, :videos, :transcripts).friendly.find(params[:id]) end
source share