Sha256: ecd496c141a6f3c0d9111279fab8f1f5c0feef5b22432e82c707eb68167c215d

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

module <%= class_name %>
  class ProjectsController < ::<%= class_name %>Controller
    require_login!
    before_filter(only: :show) { authorize!(:read, resource) }
    before_filter(only: :update) { authorize!(:update, resource) }
    before_filter(only: :index) { authorize!(:read, resource_class) }
    before_filter(only: :create) { authorize!(:create, resource_class) }

    unobtrusive finder_method: :find_by_slug!,
                resource_class: Project,
                relationship_name: :projects,
                permitted_params_key: :project,
                permitted_params_create_value: [:name],
                permitted_params_update_value: [:name]
    paginate!

    def index
    end

    def show
    end

    def create
      build_resource
      update_resource
      respond_with resource
    end

    def update
      update_resource
      respond_with resource
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
billet-0.0.1 lib/generators/billet/namespace/templates/controllers/api_controllers/projects_controller.rb.erb