can? should only go to db if there are mongoid criteria in the conditions.

Easier to just do a simple comparison on the object in memory
than to search the database.  Also this allows method calls
and other attributes that might not be found in the database.
This commit is contained in:
Tyler Gannon
2010-11-15 19:43:54 -08:00
parent dbcd93e095
commit f6aaa581ef
4 changed files with 43 additions and 28 deletions

View File

@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
s.files = Dir["{lib,spec}/**/*", "[A-Z]*", "init.rb"] - ["Gemfile.lock"]
s.require_path = "lib"
s.add_development_dependency 'rspec', '~> 2.0.0.beta.22'
s.add_development_dependency 'rspec', '~> 2.1.0'
s.add_development_dependency 'rails', '~> 3.0.0'
s.add_development_dependency 'rr', '~> 0.10.11' # 1.0.0 has respond_to? issues: http://github.com/btakita/rr/issues/issue/43
s.add_development_dependency 'supermodel', '~> 0.1.4'
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'mongoid', '~> 2.0.0.beta.19'
s.add_development_dependency 'bson_ext', '~> 1.1'
s.add_development_dependency 'ruby-debug'
# s.add_development_dependency 'ruby-debug'
s.rubyforge_project = s.name
s.required_rubygems_version = ">= 1.3.4"