Skip to content

Commit

Permalink
Added shortcut :id assignment to render_component and friends (before…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
dhh committed Mar 6, 2005
1 parent 10be1c5 commit 1019bf1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions 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]
Expand Down
6 changes: 3 additions & 3 deletions actionpack/lib/action_controller/components.rb
Expand Up @@ -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
#
Expand Down Expand Up @@ -54,7 +54,7 @@ def request_for_component(options)
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
Expand Down

0 comments on commit 1019bf1

Please sign in to comment.