[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Rails - Any way to pass state to a component?

homerlex

2/24/2006 5:07:00 PM

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

1 Answer

jgbailey

2/24/2006 6:04:00 PM

0

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.

deja@homerlex.mailshell.com wrote:
> 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