Skip to content

Adding more links to site navigation

Ronald Chan edited this page Mar 13, 2012 · 3 revisions

This guide assumes you already have site-wide navigation set up.

Suppose you already have a link, eg:

<%= link_to "New Post", new_post_path %>

Simply change the link_to helper to use the ajax_link_to helper, and say which AJAX section name you gave for the site-wide navigation.

<%= ajax_link_to "New Post", posts_post_path, :section_id => "global" %>

If you named your site-wide AJAX section "global", then the :section_id option can be omitted.

For adding AJAX links in general, and for more detail, see Creating AJAX links