Module: ControllerResources::Extension

Extended by:
ActiveSupport::Concern
Defined in:
lib/controller_resources/extension.rb

Overview

A single macro that combines all controller-level macros we use for the front-end of this application. Simply use the `resource :resource_name` macro in your controller class to make it work.

Example:

class ArtistsController < ApplicationController
  resource :artist

  def index
    respond_with artists
  end
end

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#edit_paramsObject


51
52
53
# File 'lib/controller_resources/extension.rb', line 51

def edit_params
  params.require(resource.model_name).permit resource.edit_params
end

#resourceObject


55
56
57
# File 'lib/controller_resources/extension.rb', line 55

def resource
  self.class._resource
end

#search_paramsObject


47
48
49
# File 'lib/controller_resources/extension.rb', line 47

def search_params
  params.permit resource.search_params
end