百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

turboboost

> 编程语言
开源

针对 Rails 应用程序增强的 AJAX 处理

167 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

针对 Rails 应用程序增强的 AJAX 处理

Turboboost

Turboboost extends the power of Turbolinks into the forms of your Rails app and provides additional convenient AJAX handlers for forms and links. It aims to be a seemless and logical addition to any Turbolinks-rocking Rails 3.2+ app. Currently it depends on jQuery. The main features are:

  • Form response redirection is handled by Turbolinks.
  • Customizable success and error handling through registered JavaScript, with support for Rails' Flash and optional error rendering built-in.
  • Responses can also be rendered within a scoped DOM target using jQuery selectors.
Disclaimer

In recent history Turbolinks has started to emulate some of these features with a slightly different approach. I will continue to support this library if people are still finding it useful.

Installation

In your Gemfile
ruby
gem 'turboboost'

Or to live on the very edge:

ruby
gem 'turboboost', github: 'waymondo/turboboost'

Then bundle install.

In your application.js
javascript
//= require turboboost

This will also require jQuery, jquery-ujs, Turbolinks, if not already required. If you wish to register your scripts manually, you can like so:

javascript
//= require path/to/vendored/jquery
//= require jquery_ujs
//= require turbolinks
//= require turboboost/turboboost
In your view files

Add turboboost: true to your form / link helpers:

erb

Or you can add the data attribute manually:

Redirection with Turbolinks

In its simplest server-side implementation, a basic Turboboost controller action with redirection might look like this:

ruby
def create
  post = Post.create!(params[:post]) # 
  console.log(errors) # 
  console.log(flash) # -> {'notice': 'Post was successfully created.'}

Scoped response rendering

Turboboost also provides some options for rendering AJAX responses at specific locations in the DOM:

Rails controller render option jQuery function
:within html()
:replace replaceWith()
:prepend prepend()
:append append()
:before before()
:after after()

The value can be any jQuery selector. Example usage:

ruby
respond_to do |format|
  format.html
  format.js { render partial: 'task', object: @task, prepend: "#todo-list" }
end

Issues· 9 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

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