title: undefined local variable or method `permitted_task_attributes’ for #<Api::V1::TasksController
body: <p>I have a solution that follows the paradigm of Spree/Solidus, which encapsulate permitted params. It is not in my power to change it but to follow suit. However, I am having a problem I cant reproduce which is undefined local variable or method `permitted_task_attributes’ for #Api::V1::TasksController:0x0000000000b7c0.</p>
  <p>Below is the code:</p>
  <p><strong>controller/api/v1/task_controller.rb</strong></p>
  <pre><code>module Api
    module V1
      class TasksController &lt; ApiController
        def index
          task = Task.all
          render json: task
        end
  
        def create
          task = Task.create!(create_action_params)
          if task
            render json: task
          else
            render json: task.errors
          end
        end
  
        private
  
        def create_action_params
          params.require(:task).permit(permitted_task_attributes) # The problem is with this variable `permitted_task_attributes`
        end
      end
    end
  end
  </code></pre>
  <p><strong>controller/api_controller.rb</strong></p>
  <pre><code>class ApiController &lt; ApplicationController
    before_action :set_api_request
  
    private
  
    def set_api_request
      request.format = request.format == :xml ? :xml : :json
    end
  end
  </code></pre>
  <p>li<strong>b/controller_helpers/strong_parameters.rb</strong></p>
  <pre><code>module ControllerHelpers
    module StrongParameters
      def permitted_attributes
        PermittedAttributes
      end
  
      delegate(*PermittedAttributes::ATTRIBUTES,
               to: :permitted_attributes,
               prefix: :permitted)
  
      def permitted_task_attributes
        permitted_attributes.task_attributes
      end
    end
  end
  </code></pre>
  <p><strong>lib/permitted_atrributes.rb</strong></p>
  <pre><code>module PermittedAttributes
    ATTRIBUTES = [
      :task_attributes
    ].freeze
  
    mattr_reader(*ATTRIBUTES)
  
    @@task_attributes = [
      :avatar_url, :description, :recorded_on
    ]
  end
  </code></pre>
  <p><strong>Error</strong></p>
  <pre><code>undefined local variable or method `permitted_task_attributes’ for #&lt;Api::V1::TasksController:0x0000000000b7c0&gt;
  </code></pre>
  <p>I do understand the controller do not have access to this method called <code>permitted_task_attributes</code> but I couldn't fix it. I have tried to include <code>ControllerHelpers::StrongParameters</code> in the controller and I still have uninitialized constant error. How can I fix this?</p>