checks if active record responds to 'joins', so this can work with internuity's quick_scopes gem; added .swp files to git ignore
This commit is contained in:
parent
79180de372
commit
cf263c105d
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
|||
*.swp
|
||||
**/*.swp
|
||||
*.gem
|
||||
Gemfile.lock
|
||||
.bundle
|
||||
|
|
|
@ -21,7 +21,7 @@ module CanCan
|
|||
# internally uses Ability#conditions method, see that for more information.
|
||||
def accessible_by(ability, action = :read)
|
||||
query = ability.query(action, self)
|
||||
if respond_to? :where
|
||||
if respond_to?(:where) && respond_to?(:joins)
|
||||
where(query.conditions).joins(query.joins)
|
||||
else
|
||||
scoped(:conditions => query.conditions, :joins => query.joins)
|
||||
|
|
Loading…
Reference in New Issue
Block a user