Skip to content

Commit

Permalink
Split-up parent_object's memoization and look up code.
Browse files Browse the repository at this point in the history
  • Loading branch information
thedarkone committed Feb 17, 2012
1 parent 09cc5a7 commit 43552af
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/resourceful/default/accessors.rb
Expand Up @@ -265,7 +265,11 @@ def parent_model
# Note also that the results of this method are cached
# so that multiple calls don't result in multiple SQL queries.
def parent_object
@parent_object ||= parent_model.find(params["#{parent_name}_id"])
@parent_object ||= find_parent_object
end

def find_parent_object
parent_model.find(params["#{parent_name}_id"])
end

# Assigns the current parent object, as given by parent_objects,
Expand Down

0 comments on commit 43552af

Please sign in to comment.