Sha256: 8428b7ded99ad699bef0fdd4a2a066c58d29f0b8f7845f359ba3d30d1e877dcc
Contents?: true
Size: 560 Bytes
Versions: 1
Compression:
Stored size: 560 Bytes
Contents
module ActiveRecord::Extension::WithScope def self.included(klass) # # add a custom scope. klass.named_scope :with, lambda { |*args| ActiveRecord::Extension::WithScope.options(*args) } end def self.options(*args) options = args.extract_options! if options[:conditions] && !args.empty? raise "Cannot have multiple condition entries" end unless args.empty? options = { :conditions => args }.update(options) end options end end ActiveRecord::Base.send :include, ActiveRecord::Extension::WithScope
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vex-0.6.2 | lib/vex/active_record/with_scope.rb |