Skip to content

Commit

Permalink
search object attributes in params[resource_instance_name] if they pa…
Browse files Browse the repository at this point in the history
…rams[resource_request_name] empty
  • Loading branch information
Dmitry Lihachev authored and josevalim committed Feb 24, 2011
1 parent 7da7d23 commit a6ada35
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/inherited_resources/actions.rb
Expand Up @@ -42,7 +42,7 @@ def create(options={}, &block)
def update(options={}, &block)
object = resource

if update_resource(object, params[resource_request_name])
if update_resource(object, params[resource_request_name] || params[resource_instance_name])
options[:location] ||= smart_resource_url
end

Expand Down
2 changes: 1 addition & 1 deletion lib/inherited_resources/base_helpers.rb
Expand Up @@ -49,7 +49,7 @@ def resource
# instance variable.
#
def build_resource
get_resource_ivar || set_resource_ivar(end_of_association_chain.send(method_for_build, params[resource_request_name] || {}))
get_resource_ivar || set_resource_ivar(end_of_association_chain.send(method_for_build, params[resource_request_name] || params[resource_instance_name] || {}))
end

# Responsible for saving the resource on :create method. Overwriting this
Expand Down

0 comments on commit a6ada35

Please sign in to comment.