title: Authorise user to edit a particular field using Pundit in Rails
body: <p>I'm running Pundit in my Rails app for authorisation. I seem to be getting the hang of it all but want to know how to restrict the edit or update actions to a certain field.</p>
  
  <p>For example, a user can edit their user.first_name, user.mobile or user.birthday etc but can't edit their user.role. Essentially my logic is, let the user edit anything that's cosmetic but not if it is functional.</p>
  
  <p>These fields should only be able to be edited by a user who has a 'super_admin' role (which I have setup on the user.rb with methods such as the below).</p>
  
  <pre><code>  def super_admin?
      role == "super admin"
    end
  
    def account?
      role == "account"
    end
  
    def segment?
      role == "segment"
    end
  
    def sales?
      role == "sale"
    end
  
    def regional?
      role == "regional"
    end
  
    def national?
      role == "national"
    end
  
    def global?
      role == "global"
    end 
  </code></pre>
  
  <p>I pretty much have a clean slate <code>user_policy.rb</code> file where the update and edit actions are the default </p>
  
  <pre><code>  def update?
      false
    end
  
    def edit?
      update?
    end
  </code></pre>
  
  <p>Maybe I am thinking entirely wrong about this and should just wrap a user.super_admin? if statement around the role field on the user show page but this feels wrong if I am only using that tactic for security.</p>