Sha256: 1fdd3eefa63c0f9b9d96df70b7d25efbeaf9299a79a7a3448eaf061144a8c642

Contents?: true

Size: 754 Bytes

Versions: 4

Compression:

Stored size: 754 Bytes

Contents

require 'action_controller'

module Zertico
  class Controller < ActionController::Base
    def initialize
      begin
        extend "::#{self.class.name.chomp('Controller').concat('Service')}".constantize
      rescue NameError
        extend Zertico::Service
      end
      super
    end

    def index
      respond_with(all, options)
    end

    def new
      respond_with(build, options)
    end

    def show
      respond_with(find, options)
    end

    def edit
      respond_with(find, options)
    end

    def create
      respond_with(generate, options)
    end

    def update
      respond_with(modify, options)
    end

    def destroy
      respond_with(delete, options)
    end

    def options
      @options || {}
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zertico-1.3.0 lib/zertico/controller.rb
zertico-1.2.0 lib/zertico/controller.rb
zertico-1.1.1 lib/zertico/controller.rb
zertico-1.1.0 lib/zertico/controller.rb