开发者

Rails: load a html.haml file and render it in the view?

开发者 https://www.devze.com 2022-12-30 01:00 出处:网络
How to load a html.haml file from a custom class, store in a var its data, then apply some开发者_JS百科 instance variables and render it in the view?Your description of the problem is light on details

How to load a html.haml file from a custom class, store in a var its data, then apply some开发者_JS百科 instance variables and render it in the view?


Your description of the problem is light on details, but I think your HAML file should be a partial, and you can just use

render :partial => "<your file name>", :locals => {:foo => 'bar'}

in your view, and pass the variables you want via :locals.

There is a description of working with partials in this guide.

0

精彩评论

暂无评论...
验证码 换一张
取 消