title: The elegant way to permit parameters by current user's role in Ruby on Rails?
body: <p>My application has 3 roles: <code>:admin, :manager, :editor</code> and allows all of them to create products. But these users do not have the same permitted params.</p>
  
  <pre><code>:admin =&gt; params.require(:product).permit(:a, :b, :c, :d)
  :manager =&gt; params.require(:product).permit(:a, :c, :d)
  :editor =&gt; params.require(:product).permit(:b, :d)
  </code></pre>
  
  <p>I don't like to delete the keys because the logic is very complex and it's hard to read. I'm looking the way define the logic by action and role.</p>
  
  <p>How can I permit the params by their role? What is the best way to do it? Is there any way like Pundit with authorization?</p>
  
  <p>Thank you so much.</p>
  
  <p><em>Note: <strong>[:a, :b, :c, :d]</strong> is <strong>dynamically</strong> generated by checking policies using Pundit. Is there any extension for Pundit?</em></p>