How to pass variables to render_to_string?

前端 未结 5 630
余生分开走
余生分开走 2020-12-14 06:17

Trying to do the following

@message = render_to_string ( :sender => sender, :template => \"template\" )          

But when accessing

5条回答
  •  庸人自扰
    2020-12-14 06:54

    In rails 4.0.2 this worked:

    render_to_string(partial: 'path/to/partial', locals: { argument: 'value'}
    

提交回复
热议问题