Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

pjax_rails

> 编程语言
Open source

PJAX integration for Rails

659 stars0 likes3 views
WebsiteGitHub

About

PJAX integration for Rails

PJAX for Rails

Integrate Chris Wanstrath's PJAX into Rails via the asset pipeline.

To activate, add this to your app/assets/javascripts/application.js (or whatever bundle you use):

javascript
//=require jquery.pjax

Then choose all the types of links you want to exhibit PJAX:

javascript
// 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

  

  

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

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言