Rendering partial with locals in Haml?

后端 未结 2 1947
南旧
南旧 2020-12-13 07:07

I am learning Haml.

My view files are like:

show.html.haml:

.content
  = render \'meeting_info\', :locals => { :info => @info }


        
相关标签:
2条回答
  • 2020-12-13 07:18

    You would use the :locals option if you're calling render from a controller. When calling render from a view, you would simply do this:

    = render 'meeting_info', :info => @info
    
    0 讨论(0)
  • 2020-12-13 07:30

    Try this
    Without :locals and :partial

    .content
      = render 'meeting_info', :info => @info
    

    No need to specify locals.

    With :locals and :partial
    You should specify locals in following case i.e specifying :partial for render

    .content
      = render :partial => 'meeting_info', :locals => { :info => @info }
    
    0 讨论(0)
提交回复
热议问题