Sha256: c5e36df459f70fc326a677809195b7108e91061e53a9ee82d4a5123e6cb7f2a0
Contents?: true
Size: 727 Bytes
Versions: 3
Compression:
Stored size: 727 Bytes
Contents
module Sidekiq::Apriori module Arb def self.included(base) if defined?(ActiveRecord::Base) && base < ActiveRecord::Base require 'sidekiq-apriori/arb' base.extend ClassMethods ## Add validation for priority attribute if base.attribute_names.include?('priority') base.validates_inclusion_of :priority, :in => PRIORITIES end end end module ClassMethods ## Declarative hook to prioritize instances def prioritize(options = {}, &block) method = ( block_given? && [-1, 0].include?(block.arity) ) ? block : ( options[:using] || options[:with] ) before_validation method, :on => :create end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-apriori-0.1.1 | lib/sidekiq-apriori/arb.rb |
sidekiq-apriori-0.0.3 | lib/sidekiq-apriori/arb.rb |
sidekiq-apriori-0.0.2 | lib/sidekiq-apriori/arb.rb |