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.
Showing
- cancan.gemspec 2 additions, 2 deletionscancan.gemspec
- lib/cancan/mongoid_additions.rb 15 additions, 24 deletionslib/cancan/mongoid_additions.rb
- spec/cancan/mongoid_additions_spec.rb 23 additions, 1 deletionspec/cancan/mongoid_additions_spec.rb
- spec/spec_helper.rb 3 additions, 1 deletionspec/spec_helper.rb
... | ... | @@ -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" | ||
... | ... |
Please register or sign in to comment