Skip to content

v1.1.0 Featuring Simplified Grouping

Latest
Compare
Choose a tag to compare
@bxt bxt released this 09 Oct 17:44
· 7 commits to master since this release

The syntax for grouping navigational links was simplified to reduce duplication, from:

<ul class="nav">
  <% nav_links url_segment: 1, wrapper: 'li', selected_class:'active' do |nav| %>
    <%= nav.nav_link_to "Projects", projects_path %>
    <%= nav.nav_link_to "People", people_path %>
    <%= nav.nav_link_to "About", about_path %>
  <% end %>
</ul>

To:

<ul class="nav">
  <% nav_links url_segment: 1, wrapper: 'li', selected_class:'active' do |nav| %>
    <%= nav.link_to "Projects", projects_path %>
    <%= nav.link_to "People", people_path %>
    <%= nav.link_to "About", about_path %>
  <% end %>
</ul>

Basically the nav_link_to method is now named only link_to inside of blocks. Note that you can still access rails' link_to method if you leave out the nav. part. The old method name is still supported until the 2.x release, so you can update now and take your time migrating.