Render_component

Hello all.

I have a view where I need to render an action.

If i do a render_component in the view, my action code is not executed,
and that’s bad for me…

My workaround is to do a render_component_as_string in the first action
and render this result along with my action rendering… and that’s
pretty ugly :frowning:

Is there a way to do it another way?

Pedro C. wrote:

Hello all.

I have a view where I need to render an action.

If i do a render_component in the view, my action code is not executed,
and that’s bad for me…

My workaround is to do a render_component_as_string in the first action
and render this result along with my action rendering… and that’s
pretty ugly :frowning:

Is there a way to do it another way?

Put the action in the controller code?

If you are going to do this in a lot of places you could put the action
as a method in application.rb and use a shared partial for its view.