# pjax_rails **Repository Path**: mirrors_rails/pjax_rails ## Basic Information - **Project Name**: pjax_rails - **Description**: PJAX integration for Rails - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-18 - **Last Updated**: 2025-12-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README PJAX for Rails =================== [![Build Status](https://travis-ci.org/rails/pjax_rails.png?branch=master)](https://travis-ci.org/rails/pjax_rails) Integrate Chris Wanstrath's [PJAX](https://github.com/defunkt/jquery-pjax) into Rails via the asset pipeline. To activate, add this to your app/assets/javascripts/application.js (or whatever bundle you use): ```js //=require jquery.pjax ``` Then choose all the types of links you want to exhibit PJAX: ```js // app/assets/javascripts/application.js $(function() { $(document).pjax('a:not([data-remote]):not([data-behavior]):not([data-skip-pjax])', '[data-pjax-container]') }); ``` For this example, the PJAX container has to be marked with data-pjax-container attribute, so for example: ```erb
<%= Time.now %>
<%= content_tag :h3, 'My site' %> <%= link_to 'About me', about_me_path %> <%= link_to 'Google', 'http://google.com', 'data-skip-pjax' => true %>
``` ## Layouts By default, the `pjax_rails` gem will not render your application layout file and will instead only return the yielded view. But if you have additional content you want to always be returned with your pjax requests, you can override `pjax_layout` in your controller and specify a layout to render (by default, it's `false`) ```ruby class ApplicationController < ActionController::Base def pjax_layout 'pjax' end end ```