Sha256: 7211f223f64d50df773c9083049def3c8bcc3770192cd53b83640e6562c59a3b

Contents?: true

Size: 834 Bytes

Versions: 1

Compression:

Stored size: 834 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
      all
      respond_with(@responder, @options)
    end

    def new
      build
      respond_with(@responder, @options)
    end

    def show
      find
      respond_with(@responder, @options)
    end

    def edit
      find
      respond_with(@responder, @options)
    end

    def create
      generate
      respond_with(@responder, @options)
    end

    def update
      modify
      respond_with(@responder, @options)
    end

    def destroy
      delete
      respond_with(@responder, @options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zertico-1.0.0 lib/zertico/controller.rb