rails access view name inside partial

后端 未结 4 1115
梦谈多话
梦谈多话 2021-02-19 12:57

I have a partial that I am using in different pages. I want to conditionally hide a certain div inside the partial based on the view that is rendering it.

I was thinkin

4条回答
  •  悲&欢浪女
    2021-02-19 13:20

    You could send the style parameter as a local variable to the partial, varying the parameter depending on where you're calling from. Something like:

    render :partial => 'xyz', :locals => {:style => 'display:none or display:block'}
    

    and in the partial you could do:

    >

提交回复
热议问题