Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #705 from albertobajo/mongoid_find_by
Browse files Browse the repository at this point in the history
Fixed load_resource "find_by" in mongoid resources
  • Loading branch information
ryanb committed Feb 22, 2013
2 parents cbd352c + 4a5700c commit ba82241
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/cancan/controller_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def find_resource
if @options[:find_by]
if resource_base.respond_to? "find_by_#{@options[:find_by]}!"
resource_base.send("find_by_#{@options[:find_by]}!", id_param)
elsif resource_base.respond_to? "find_by"
resource_base.send("find_by", { @options[:find_by].to_sym => id_param })
else
resource_base.send(@options[:find_by], id_param)
end
Expand Down

0 comments on commit ba82241

Please sign in to comment.