Forum: Ruby Rails - Any way to pass state to a component?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
47df9891a167136ac0444054edaa31ba?d=identicon&s=25 unknown (Guest)
on 2006-02-24 18:09
(Received via mailing list)
I am trying set up a rails app that utilizes components.  I need to be
able to pass some state (a bunch of name value pairs) from the Main
controller to the component.

Is there any way to pass this state info using render_component?

Regards
573b9499030e1ccb867ef80f0ff1ac49?d=identicon&s=25 m4dc4p (Guest)
on 2006-02-24 19:11
(Received via mailing list)
Check the docs, but I believe you can pass a hash called :params with
any name-value pairs you need. They then show up in the @params
instance variable in the components controller:

render_component :controller => "foo", :action => "bar", :params => {
:baz => "bil" }
....
class FooController
....
  def bar
     @baz = @params[:baz] # "bil"
     ...
  end

HTH.
This topic is locked and can not be replied to.