aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-06 17:27:11 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-06 17:27:11 +0000
commit1019bf15a31b39f0fb193d90d6a54f6bd41a2c96 (patch)
treee8f19a2f2045b44a8212f1f515c2281f9403cffd /actionpack
parent10be1c59f8999f91dd08c21a1e4104d664cf8150 (diff)
downloadrails-1019bf15a31b39f0fb193d90d6a54f6bd41a2c96.tar.gz
rails-1019bf15a31b39f0fb193d90d6a54f6bd41a2c96.tar.bz2
rails-1019bf15a31b39f0fb193d90d6a54f6bd41a2c96.zip
Added shortcut :id assignment to render_component and friends (before you had to go through :params) #784 [Lucas Carlson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@862 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/components.rb6
2 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 6f1bd4d3d7..961a76e54e 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Added shortcut :id assignment to render_component and friends (before you had to go through :params) #784 [Lucas Carlson]
+
* Fixed that map.connect should convert arguments to strings #780 [Nicholas Seckar]
* Added UrlHelper#link_to_if/link_to_unless to enable other conditions that just link_to_unless_current #757 [mindel]
diff --git a/actionpack/lib/action_controller/components.rb b/actionpack/lib/action_controller/components.rb
index f4fa05504b..5b6940b189 100644
--- a/actionpack/lib/action_controller/components.rb
+++ b/actionpack/lib/action_controller/components.rb
@@ -6,13 +6,13 @@ module ActionController #:nodoc:
# # Performs a method and then lets hello_world output its render
# def delegate_action
# do_other_stuff_before_hello_world
- # render_component :controller => "greeter", :action => "hello_world"
+ # render_component :controller => "greeter", :action => "hello_world", :params => { "person" => "david" }
# end
# end
#
# class GreeterController < ActionController::Base
# def hello_world
- # render_text "Hello World!"
+ # render_text "#{@params['person']} says, Hello World!"
# end
# end
#
@@ -54,7 +54,7 @@ module ActionController #:nodoc:
request_for_component = @request.dup
request_for_component.send(
:instance_variable_set, :@parameters,
- (options[:params] || {}).merge({ "controller" => options[:controller], "action" => options[:action] })
+ (options[:params] || {}).merge({ "controller" => options[:controller], "action" => options[:action], "id" => options[:id] })
)
return request_for_component
end