aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/responder.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-08-13 10:27:41 +0200
committerJosé Valim <jose.valim@gmail.com>2009-08-13 10:27:41 +0200
commit4f9047ecc8f0e2c3d4491bae0051679569da71dc (patch)
treed6ee2c4f473b4ef5558e7d01325f7be5d5ce9ec7 /actionpack/lib/action_controller/metal/responder.rb
parent5f7cfffc5377824e03432d7773ed8864a872b18c (diff)
downloadrails-4f9047ecc8f0e2c3d4491bae0051679569da71dc.tar.gz
rails-4f9047ecc8f0e2c3d4491bae0051679569da71dc.tar.bz2
rails-4f9047ecc8f0e2c3d4491bae0051679569da71dc.zip
Ensure collections are not treated as nested resources.
Diffstat (limited to 'actionpack/lib/action_controller/metal/responder.rb')
-rw-r--r--actionpack/lib/action_controller/metal/responder.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/metal/responder.rb b/actionpack/lib/action_controller/metal/responder.rb
index 9ed99ca623..fc01a0924a 100644
--- a/actionpack/lib/action_controller/metal/responder.rb
+++ b/actionpack/lib/action_controller/metal/responder.rb
@@ -64,7 +64,7 @@ module ActionController #:nodoc:
# @project = Project.find(params[:project_id])
# @task = @project.comments.build(params[:task])
# flash[:notice] = 'Task was successfully created.' if @task.save
- # respond_with([@project, @task])
+ # respond_with(@project, @task)
# end
#
# Giving an array of resources, you ensure that the responder will redirect to
@@ -74,19 +74,19 @@ module ActionController #:nodoc:
# polymorphic urls. If a project has one manager which has many tasks, it
# should be invoked as:
#
- # respond_with([@project, :manager, @task])
+ # respond_with(@project, :manager, @task)
#
# Check polymorphic_url documentation for more examples.
#
class Responder
attr_reader :controller, :request, :format, :resource, :resource_location, :options
- def initialize(controller, resource, options={})
+ def initialize(controller, resources, options={})
@controller = controller
@request = controller.request
@format = controller.formats.first
- @resource = resource.is_a?(Array) ? resource.last : resource
- @resource_location = options[:location] || resource
+ @resource = resources.is_a?(Array) ? resources.last : resources
+ @resource_location = options[:location] || resources
@options = options
end