Sha256: 7cb927b9874c596bb319443ef41ed90fb2246af2f6cf4c3a503cfa3089e700f3
Contents?: true
Size: 832 Bytes
Versions: 1
Compression:
Stored size: 832 Bytes
Contents
module RestfulController class Base ACTIONS = [:index, :show, :edit, :update, :create, :destroy, :new] def self.inject(base, actions = []) actions_to_include = actions_to_include(actions) base.class_eval do include Helpers include Filters actions_to_include.each do |action| include "RestfulController::Actions::#{action.capitalize}".constantize end end end private def self.actions_to_include(actions) if actions.empty? ACTIONS elsif actions.length == 1 && actions.first.is_a?(Hash) hash = actions.first if hash[:except] ACTIONS - Array(hash[:except]) elsif hash[:only] Array(hash[:only]) end else actions end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
restful-controller-0.0.3 | lib/restful_controller/base.rb |