Hegwin.Me
The hydra-universe twisting its body scaled in stars.
Home
Tools
WoW Battle Pet
Meow Etymons
About
Counter Cache and counter_culture
Counter Cache 和 counter_culture
Ruby on Rails
Jan 08, 2024
Have you ever encountered a requirement where, assuming we are a book review site (e.g., douban.com), we need to display the number of reviews for each record in a list of books. We'll have a Book model and a Review model, which have a one-to-many relationship, `Book.has_many :reviews `. The most straightforward approach would be to do something like `books.each...
Upgrade Ruby from 3.0 to 3.2
升级 Ruby 到 3.2
Ruby
Ruby on Rails
Nov 05, 2023
Now that Ruby 3.3 preview 2 has been released, I've been working on upgrading a 3.0 project to 3.2. I've encountered a few problems with upgrading from 3.0 to 3.2, so I'm going to try to organize them here, and hopefully they'll help. ## Bundled gems In Ruby 3.1, some libs went from being standard libraries to bundled gems, such...
Takeaways from Ruby Conf China 2023 Day 2
Ruby Conf China 2023 参会笔记 Day 2
Ruby
Ruby on Rails
AI
Aug 28, 2023
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
Ruby on Rails
Ruby
Application Security
AI
Aug 27, 2023
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一系列变化的应对策略
Ruby on Rails
Apr 02, 2023
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 on Rails
bundler
Oct 30, 2019
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 应用的内存优化
Ruby on Rails
GC
Memory
Oct 13, 2018
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 渐进式网页应用
PWA
Ruby on Rails
Dec 14, 2017
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
Rails优化SQL可能用到的工具
Ruby
Ruby on Rails
SQL Performance
Sep 27, 2017
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?
修改Repo地址后Capistrano部署问题
Ruby on Rails
Capistrano
CI
Feb 28, 2017
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...
Next Page >