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
|
*.gem
|
||||||
Gemfile.lock
|
Gemfile.lock
|
||||||
.bundle
|
.bundle
|
||||||
|
|
|
@ -21,7 +21,7 @@ module CanCan
|
||||||
# internally uses Ability#conditions method, see that for more information.
|
# internally uses Ability#conditions method, see that for more information.
|
||||||
def accessible_by(ability, action = :read)
|
def accessible_by(ability, action = :read)
|
||||||
query = ability.query(action, self)
|
query = ability.query(action, self)
|
||||||
if respond_to? :where
|
if respond_to?(:where) && respond_to?(:joins)
|
||||||
where(query.conditions).joins(query.joins)
|
where(query.conditions).joins(query.joins)
|
||||||
else
|
else
|
||||||
scoped(:conditions => query.conditions, :joins => query.joins)
|
scoped(:conditions => query.conditions, :joins => query.joins)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user