Saeloun Blog
https://blog.saeloun.com/
Ruby on Rails and ReactJS consulting company. We also build mobile applications using React Native
フィード

Upgrading from Rails 4.2 to Rails 5 - A Complete Guide
Saeloun Blog
Rails 5 brought major improvements: ActionCable for WebSockets, API mode, Turbolinks 5, and ActiveJob integration.But it also introduced breaking changes that require careful migration.If we’re still on Rails 4.2 (EOL since 2016), this upgrade is critical for security and performance.Let’s walk through the key changes and how to handle them.Note: This is Part 2 of our Rails Upgrade Series. Read Part 1: Planning Rails Upgrade for strategic planning guidance.Before We StartExpected Timeline: 2-4 weeks for medium-sized applicationsMedium-sized application: 20,000-50,000 lines of code, 30-100 models, moderate test coverage, 2-5 developers. Smaller apps may take 1-2 weeks, larger enterprise apps 6-12 weeks.Prerequisites:Test coverage of 80%+Ruby 2.2.2+ installed (Ruby 2.3+ recommended)Backup of production databaseStaging environment for testingRuby Version RequirementsRails 5 requires Ruby 2.2.2 minimum, but we strongly recommend Ruby 2.3 or 2.4 for production.Why Upgrade Ruby First?Ruby 2.
2日前

Rails 8.1 Introduces Structured Event Reporting with Rails.event
Saeloun Blog
IntroductionModern observability platforms thrive on structured data.They can parse JSON, extract fields, build dashboards,and alert on specific conditions.But Rails has traditionally given us Rails.logger,which produces human readable but unstructured log lines.Parsing these logs for analytics is painful.We end up writing regex patterns,hoping the log format doesn’t change,and losing valuable context along the way.Rails 8.1 introduces a first class solution:the Structured Event Reporter,accessible via Rails.event.BeforeBefore this change,logging in Rails meant working with unstructured text.Rails.logger.info("User created: id=#{user.id}, name=#{user.name}")This produces a log line like:User created: id=123, name=John DoeTo extract meaningful data from this,observability tools need to parse the string.If we change the format slightly,our parsing breaks.We also lack consistent metadata.Where did this log come from?What request triggered it?What was the timestamp with nanosecond precisio
3日前

Rails 8.1 introduces bin/ci to standardize CI workflows with a new DSL
Saeloun Blog
Rails 8.1 introducesbin/ci to standardize CI workflows based on a new domain specific language (DSL)in config/ci.rb making it easier to define,run and maintain the CI pipelines.Understanding the DSL in config/ci.rbThe new DSL allows us to define CI steps in a structured and readable way.step: Defines a single step in the workflow. The first argument is the step’s name and the remaining arguments form the command to execute.success?: Returns true if all previous steps passed, allowing conditional logic.failure: Displays a failure message with a description when the workflow fails. Takes two arguments: the message and a description.CI.run do step "Setup", "bin/setup --skip-server" step "Style: Ruby", "bin/rubocop" step "Security: Brakeman code analysis", "bin/brakeman", "--quiet", "--no-pager", "--exit-on-warn", "--exit-on-error" step "Security: Importmap vulnerability audit", "bin/importmap", "audit" step "Tests: Rails", "bin/rails", "test", "test:system" step "Tests: Seeds", "env RAILS
4日前

Planning Rails Upgrade - A Strategic Guide
Saeloun Blog
Rails upgrades can feel daunting due to breaking changes, gem compatibility issues and potential downtime.But staying on outdated versions is riskier.Security vulnerabilities accumulate, performance suffers,andwe miss powerful features that make development easier.With proper planning, Rails upgrades can be smooth and predictable.This five part series shares proven strategies from dozens of successful upgrades.Why Upgrade Now?Let’s look at the current Rails ecosystem (as of December 2025):Rails 8.x: Early adoption phase (~5% of applications)Rails 7.x: ~40% of active applicationsRails 6.x: ~35% of applicationsRails 5.x and older: ~20% still runningRails 8 was released in November 2024, so adoption is still ramping up.If we’re on Rails 6 or earlier, we’re not alone—but we should plan our upgrade path.The Real Cost of WaitingSecurity: Rails 4.2 reached EOL in 2016. Ruby 2.7 reached EOL in March 2023. No security patches means real vulnerability.Performance: Ruby 3.3 with YJIT (supported b
9日前

Accessibility Best Practices for Consultancy Websites
Saeloun Blog
A good website doesn’t just look nice, it works for everyone. Accessibility ensures that all users, including those with disabilities, can easily browse, understand, and interact with your site.For consultancy websites, accessibility also builds trust. It shows professionalism, attention to detail, and a genuine commitment to inclusivity.Why Accessibility MattersWhen a consultancy site is accessible, it sends a clear message: you care about people and their experience. It’s not only the right thing to do but also good for business.Here’s why accessibility matters:Wider reach. Millions of users rely on assistive technologies such as screen readers or voice navigation.Better usability. Accessibility improvements often make the site easier for everyone, not just people with disabilities.Stronger SEO. Search engines favor clear structure, proper headings, and readable content.Legal compliance. Many regions require digital accessibility by law. Following best practices helps you stay compli
9日前

Rails Native Composite Primary Keys: A Complete Evolution from Rails 3 to Rails 8
Saeloun Blog
IntroductionComposite Primary Keys (CPKs) are one of those “real world engineering” features that frameworks eventually grow into. Many enterprise databases, analytics systems, geographic indexes, and ledger tables naturally model identity using more than one attribute.For years, Rails avoided this space and assumed a single integer column called id, and our applications were expected to adapt with Rails 8, this is finally changing. The framework now understands identity that is multi column, not just “one number per record”.Even more interesting: Rails does this without requiring external gems, and without asking us to break conventions everywhere. The feature is still maturing, but its foundations are strong enough that we can start building real systems on top of it.In this post, we walk through the full Rails journey where we came from, why this matters, how to use the new API, and how to migrate from gem based systems to native CPK support thoughtfully.A Brief History of Identity
11日前

A Guide to Web Application Monitoring
Saeloun Blog
Web application monitoring is the nervous system for our software—continuously listening, collecting signals, and analyzing them to catch problems before they become outages. A one-hour outage can cost millions.Amazon lost an estimated USD 34 million in 2021, while Meta lost close to USD 100 million in a similar incident. Effective monitoring moves our team from reactive firefighting to proactive fire prevention.The Four Pillars of TelemetryModern applications are complex, distributed systems with dozens of moving parts. Without visibility into what’s happening inside, we’re flying blind. Monitoring solves this by collecting four types of telemetry data:1. Metrics: The Vital SignsMetrics are numeric measurements taken at regular intervals—response time, error rate, CPU usage, and throughput. They’re cheap to store and fast to query, making them perfect for dashboards and alerts.2. Logs: The Detailed NarrativeWhile metrics tell us what happened, logs tell us why. When a 500 Internal Ser
17日前

Non‑Blocking IO.select in Ruby: Introduction to Fiber::Scheduler#io_select
Saeloun Blog
IntroductionRuby 3.1 introduced Fiber::Scheduler#io_select, making IO.select work seamlessly with fiber-based concurrency. Before diving in, let’s clarify some key concepts.What’s a Fiber?A fiber is a lightweight, pausable unit of execution in Ruby. Unlike threads, fibers don’t run in parallel—they cooperatively yield control to each other, making them predictable and efficient for I/O-bound tasks.fiber = Fiber.new do puts "Starting" Fiber.yield # Pause here puts "Resuming"endfiber.resume # => "Starting"fiber.resume # => "Resuming"What’s a Scheduler?A scheduler manages when fibers run. When a fiber performs I/O (like reading from a socket), the scheduler pauses it and runs other fibers instead of blocking. This enables non-blocking I/O without callbacks or threads.Popular schedulers include the Async gem, which powers the Falcon web server.Real-World ExampleImagine building a web scraper that fetches 100 URLs. With traditional blocking I/O, you’d wait for each request sequentially. Wit
18日前

Customizing Rails Migrations with Execution Strategies
Saeloun Blog
IntroductionRails migrations are powerful tools for managing database schema changes.However, there are scenarios where we need more control over how these migrations execute.We might need to log every schema change for audit purposes.We might want to prevent dangerous operations in production environments.Or we might need to route migrations through an external service for distributed systems.Rails 7.1 introduced Execution Strategies to address these needs.This feature provides a way to customize the entire migration execution layer.Rails 8.1 further enhanced this by allowing per-adapter strategy configuration.This post explores how Execution Strategies work and demonstrates practical use cases.Before Rails 7.1Before Rails 7.1, migrations had limited customization options.A typical Rails migration looked like this:class CreateUsers < ActiveRecord::Migration[7.0] def change create_table :users do |t| t.string :name t.timestamps end endendWhen we called create_table, Rails used method_m
23日前

UI/UX Audit Checklist Before Redesigning a Site
Saeloun Blog
Before jumping into a website redesign, it’s worth taking a step back to see what’s actually working and what’s not. A proper UI/UX audit helps you understand your current website from both a design and user perspective. It’s like a health check before surgery — it saves time, money, and effort later.Why a UI/UX Audit MattersA redesign without an audit often leads to repeating old mistakes. Instead of guessing what needs improvement, a UI/UX audit gives you a clear roadmap. It helps you see how real users experience the site and what’s stopping them from reaching their goals.An audit helps you:Identify design inconsistencies and outdated visualsFind usability issues that frustrate visitorsUnderstand how users actually navigate your siteDiscover content gaps or unclear messagingPrioritize what needs to change firstKey Areas to Review in a UI/UX AuditWhen running a UI/UX audit, it’s best to break things down into focused sections.1. Visual DesignLook at how your site looks and feels over
24日前