在查看对象时如何让左侧边栏呈现?

时间:2017-08-28 23:08:57

标签: ruby-on-rails layout sidebar

我对铁杆很新,很抱歉,如果我不清楚的话。我有一个在布局中称为项目的对象我有_left_column.html.erb,它根据我所在的页面向左栏添加内容。在这种情况下,东西是与其相关的其他对象的信息(诸如任务之类的东西)。

截图:

enter image description here

我的工作方式如图所示,但仅适用于ID为1的项目。我不确定如何在所有项目中使用它。谢谢!

1 个答案:

答案 0 :(得分:0)

我会尝试为您的代码提供一些提示

<% case request.path.split('?').first.to_s %>
  <% when 'projects/1' %>
    # this is the problem, 
    # all code below when 'projects/1' only running if projects equal to 1
    # if you want all code below running you can try remove the logic when
  <% end %>
<% end %>