The hydra-universe twisting its body scaled in stars.

Takeaways from Ruby Conf China 2023 Day 2

Ruby Conf China 2023 参会笔记 Day 2

This year, AI is really a hot topic, from EverythingGPT to LLM, everyone is talking about this new technological change. At the two-day Ruby Conf China 2023, there were also three topics focusing on AI and LLM, which was very exciting. This post records what I learned on the second day of Ruby Conf. There were two speakers talking about...

Takeaways from Ruby Conf China 2023 Day 1

Ruby Conf China 2023 参会笔记 Day 1

Last weekend (August 19-20, 2023), Ruby Conf China was successfully held in Shanghai. This was the first time since COVID-19 that Ruby Conf was held offline - we've been waiting for it for three years. It's amazing that the venue was the same one we booked for Ruby Conf 2021 three years ago (JW Marriott at Tomorrow Square); Due to...

Rotate cookies when upgrading to Rails 7

Rails 7升级过程中针对cookie一系列变化的应对策略

Rails 7 brought a number of new features as well as breaking changes, which made the upgrade from 6.1 more troublesome than the previous one. Rails modified the default cookie serilaizer and the default encryption method, causing incompatibility between the old and new cookies, so the upgrade needs to be done in steps to ensure the best user experience. #...

Run specific version of bundler

运行特定版本的 bundler

Ruby Little (Useless) Trick (Skill) series. When you have two versions of bundler installed at the same time, say 2.0.1 and 1.17.2, by default `bundle exec` and other commands use the latest version of bundler; If you are maintaining an old program, then you may run into this magic problem due to the incompatibility of bundlers like this: ``` Bundler...

Improve Memory for Your Rails App

Rails 应用的内存优化

I was in Zhengzhou today for the two-day Ruby Summit China 2018; the Summit was held at the "Big Corn" in Zhengzhou. I didn't expect that a city like Zhengzhou, where the density of Internet companies is not that high, could host an Internet conference of this scale (Ruby Summit was just one of the sessions). What was even more...

Takeaways from Google Developer Days 2017: PWA Progressive Web App

谷歌开发者大会2017心得:PWA 渐进式网页应用

This is the second post in the Google Developer Days 2017 Take Ways series. Progressive Web App (PWA) was a recurring technology at this year's GDG, and I participated in at least two talks on the topic of PWA. The main problem that PWA is trying to solve is the ability to make a Web App nearly as efficient as...

Tools to Help to Improve SQL in Rails


Have you ever encountered a Rails app that is slow in rendering pages? Are you trying to find out what's causing it to be "slow"? Where is the performance bottleneck? Is it the slow execution of SQL queries (maybe N+1, or not having the right indexes), or is it something else, like the view being too big? Performance optimization has...

How to Deploy with Capistrano after Repo URL changed?


We are using Capistrano to deploy our project and recently migrated the project repository from BitBucket to Github. I thought I could just simply change `set :repo_url` in `config/deploy.rb`, but that's not the case. When I executed the deployment with Cap, I saw that the code in the log was still taken from the BitBucket repo, and all the changes...

Implement HTTP Long Polling in Rails with Action Controller Live

在Rails中实现HTTP Long Polling

By using ActionController::Live, we can achieve real-time Push communication. The official documentation is here http://edgeapi.rubyonrails.org/classes/ActionController/Live.html, but I always feel that this documentation is too abbreviated for learning. The main techniques used here are these: When the HTTP/1.1 Header is specified as Transfer-Encoding: chunked, the data will be chunked and returned continuously

Rails Authorization with Pundit


After people started using Rails 4, `cancan` was criticized for its complexity and lack of compatibility fixes, and people turned to a new tool Pundit. `Pundit` is a pure ruby gem for permission verification. Basic idea: Pundit, for objects that need to be authorized, according to the user's actions, will go to the corresponding policy of this object to find...