Module: Cuprum::Rails::Controller

Defined in:
lib/cuprum/rails/controller.rb

Overview

Provides a DSL for defining actions and responses.

Examples:

Defining A Controller

class ExampleController < ApplicationController
  include Cuprum::Rails::Controller

  responder :html, CustomHtmlResponder

  action :process, ExampleProcessAction
end

Defining A RESTful Controller

class BooksController
  include Cuprum::Rails::Controller

  responder :html, Cuprum::Rails::Responders::Html::Resource

  action :index,     Cuprum::Rails::Actions::Index
  action :show,      Cuprum::Rails::Actions::Show, member: true
  action :published, Books::Published
  action :publish,   Books::Publish,               member: true
end

Defined Under Namespace

Classes: UndefinedResourceError, UnknownFormatError

Instance Method Summary collapse

Instance Method Details

#action_optionsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



53
54
55
56
57
58
# File 'lib/cuprum/rails/controller.rb', line 53

def action_options
  {
    repository: self.class.repository,
    resource:   self.class.resource
  }
end