A modest blog platform crafted for developers
Continue with Twitter
Continue with Github
By creating an account I accept Bloggie's
Terms of Service
ViewComponent: My attempt to answer what value it brings
A brief introduction to ViewComponent: the API, folder structure, values and concerns.
Dec 17, 2020
Install latest libvips for image_processing on Heroku
Active Storage default variant processor changed to :vips since Rails 7. Learn how to install the required libvips on Heroku.
Feb 14, 2022
Rails controller actions ordering convention
See what's the default order Rails scaffold generates. A Rubocop Cop is also on the way.
Jan 28, 2022
RSpec define inline class to test modules
It can be useful to define an inline disposable class in the spec so you can test a module/concern or a middleware cleanly and separately.
Dec 14, 2020
The Practical Usage of factory_bot Transient Attributes
Learn how Transient Attributes works and how to simplify the setup of associated records with it.
Mar 29, 2020
A few notes on upgrading to Rails 6
I had the opportunity to upgrade 3 Rails apps. Here are some notes from that experience.
Oct 20, 2019
Prevent Turbolinks from reloading the page when clicking anchor links
A quick workaround to make it behave as expected.
Oct 1, 2019
TL;DR - Include the CSRF token in the headers to avoid the InvalidAuthenticityToken exception.
Aug 18, 2019
Upgrade Guide: ActiveStorage in Rails 6 and ImageProcessing
The good and caveats when using ActiveStorage after upgrading to Rails 6
May 26, 2019
Migrate from chromedriver-helper to Webdrivers
chromedriver-helper is out of support as of 2019-03-31. Webdrivers is recommended as the replacement. It's also included in the Rails 6 Gemfile. Time for the switch! ️ Install Webdrivers gem bundle install and it's (almost) done! There is no...
May 17, 2019
Stimulus: Stop event chain in the middle of multiple actions
Stimulus supports multiple actions on a single element. For example, you can have a link like this: When the link is clicked, it'll go through session_controller.js first to check whether the user is logged in, and if so, continue to comment_co...
Apr 17, 2019
bootstrap.native: How to Use Toast Component
In my previous post, I covered how to use bootstrap.native so you can drop the jQuery dependency right now. In this post, I'm gonna share how to use Toast component with bootstrap.native. Toast UI This popular UI component was added in Bootst...
Mar 13, 2019
bootstrap.native - Bootstrap without jQuery
Bootstrap 5 will remove jQuery as a dependency. That's good news ! But if you want to drop the dependency right now, you can accomplish it with bootstrap.native. bootstrap.native is a third-party plugin that perfectly mimics Bootstrap with vanil...
Feb 22, 2019
Sending POST Requests With window.fetch In Rails
TL;DR Be sure to include the CSRF token into the headers, otherwise, you'll run into InvalidAuthenticityToken exception. In old-fashioned Rails apps, CSRF token is handled by rails-ujs transparently so there is no extra work for you. However,...
Jan 7, 2019
Rails: Enable Coffeescript with Webpacker
Oct 24, 2018
Capybara: Trigger Blur Event
Aug 16, 2018
You Might Still Need the Turbolinks Rails Gem Even with Webpacker
After switching from Sprockets to Webpacker, I also dropped the gem Turbolinks from my Gemfile and integrated it with Webpacker. That had been running well until redirect_to stopped working. To be more accurate: It appeared redirect_to won't up...
Aug 9, 2018
Rails: The Convenient Way to Load Custom Configuration Yaml File
Rails.application.config_for is a convenient method to load custom yaml file from config/ folder for your current environment - development, test, and production. Getting Started For example, you have a payment config file like this: Rails.a...
Aug 2, 2018
Error during rails credentials:edit "ActiveSupport::MessageEncryptor::InvalidMessage"
I was trying to add a Slack webhook to the Rails app, when I ran bin/rails credentials:edit I got the error ActiveSupport::MessageEncryptor::InvalidMessage. Why that happened? It turned out it was because I lost the key 😅 (config/master.key) . T...
Jul 23, 2018
Rails: Render Markdown Views and Partials
Assume you have a markdown contents saved in a partial _about.md and you want to render it in your view. Custom Template Handler First, you would need to register the type/extension of .md and map it into a customized handler - let's call i...
Jul 10, 2018
Return to the previous or a specific page after login with OmniAuth
It's a common practice to return the user to the previous page or a specific page after he/she successfully logged in. If you're using OmniAuth, it's already well supported in the gem! The is request.env['omniauth.origin']. Scenario: return to ...
Apr 9, 2018
7 Practical Tips for ActiveStorage on Rails 5.2
Get you started with Active Storage. Understand its data model, common usages, how to write the test, and possible gotchas.
Apr 4, 2018