Now I’m trying to make path markup.
Assume it’s up to 4th depth level directory then I made something like this for view?
How can I pass the path to view from controller with variable label???
<% if !@FirstDirPath.nil? %>
<%= @FirstDirPath %> <span class="divider">/</span>
<% end %>
<% if !@SecondDirPath.nil? %>
<%= @SecondDirPath %> <span class="divider">/</span>
<% end %>
<% if !@ThirdDirPath.nil? %>
<%= @ThirdDirPath %> <span class="divider">/</span>
<% end %>
<% if !@FourthDirPath.nil? %>
<%= @FourthDirPath %> <span class="divider">/</span>
<% end %>
You can access the current path with
request.fullpathIf you want to get the breadcrumb then you can just split the fullpath by ‘/’. In the controller:
In the view:
Untested, but I think it should work.