Skip to content

Commit

Permalink
checks if active record responds to 'joins', so this can work with in…
Browse files Browse the repository at this point in the history
…ternuity's quick_scopes gem; added .swp files to git ignore
  • Loading branch information
ramontayag authored and ryanb committed Nov 12, 2010
1 parent 79180de commit cf263c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.swp
**/*.swp
*.gem
Gemfile.lock
.bundle
2 changes: 1 addition & 1 deletion lib/cancan/active_record_additions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module ClassMethods
# 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)
Expand Down

0 comments on commit cf263c1

Please sign in to comment.