Background There are many gems for implementing two-factor authentication for Rails app out there. But, most of them don't work properly with Devise out from the box. Some gems offering seamless integration with Devise gem never work smoothly with our existing Rails app. This is why we share our experience and strategy to implement two-factor authentication using Devise and ActiveModel::Otp gems. This implementation, based on our experience, works very well with the latest Google Authenticator app…
Why Bullet Gem? For this Rails optimization, we'll focus on optimizing repeated SQL calls to retrieve objects associated with many relationships: N+1 queries problem. The solution to such an issue is an eager loading association. Unoptimized N+1 affected code takes a significantly longer time as N times additional SQL calls are needed. But, we should be careful when using that eager loading approach. This because unused eager loading can deteriorate our Rails app performance instead of improving…
Accelerated Mobile Page (AMP) is a framework for creating a fast and light-weight mobile website. There are not many ruby gems for creating AMP pages for the existing Rails website. We find one like rails_amp. But it doesn't fit our needs. That's why we come up with our solution. It's a simple but powerful one. Here's how we create AMP pages for our Rails website. Add custom Mime::Type We add custom Mime at config/initializers/mime_types.rb
It's only one line code. The code registers amp as a new…
Score: 1.0
Privacy settings changed!
Article is saved. Do you want to continue editing the article or leave and edit later?