Sha256: 2673371902b3517b9e41b70fafc5beb38cf1e1d95abf34893400c1ca2df996b7
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
module ActiveFedora # = Active Fedora \Named \Scopes module Scoping module Named extend ActiveSupport::Concern module ClassMethods # Returns an <tt>ActiveFedora::Relation</tt> scope object. # # posts = Post.all # posts.size # Fires "select count(*) from posts" and returns the count # posts.each {|p| puts p.name } # Fires "select * from posts" and loads post objects # # fruits = Fruit.all # fruits = fruits.where(color: 'red') if options[:red_only] # fruits = fruits.where(size: ['big', 'little']) # gets big or little fruit # fruits = fruits.limit(10) if limited? # # You can define a scope that applies to all finders using # <tt>ActiveRecord::Base.default_scope</tt>. def all if current_scope current_scope.clone else scope = relation scope.default_scoped = true scope end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active-fedora-9.7.3 | lib/active_fedora/scoping/named.rb |
active-fedora-9.7.2 | lib/active_fedora/scoping/named.rb |