Sha256: c0bd04ce5dcbafa7db397b4c3d54eca7f26b39f24189f05d207b4554bbfd9313
Contents?: true
Size: 772 Bytes
Versions: 1
Compression:
Stored size: 772 Bytes
Contents
require "batch_actions/version" require "batch_actions/class_methods" module BatchActions def batch_actions return [] unless self.class.instance_variable_defined? :@batch_actions actions = self.class.instance_variable_get :@batch_actions allowed = [] actions.each do |keyword, condition| if instance_exec(&condition) allowed << keyword end end allowed end def batch_action action = params[:name] raise "action is not allowed" unless batch_actions.include? action.to_sym send(:"batch_#{action}") end def self.included(base) base.extend ClassMethods if defined?(InheritedResources::Base) && base < InheritedResources::Base base.batch_model base.resource_class end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
batch_actions-0.0.1 | lib/batch_actions.rb |