ruby
ruby
ruby
What is params.expect and how to use it in Rails 8?
params.expect in Rails 8 replaces require/permit and fixes a real weakness: crafted params like ?user=string used to raise NoMethodError and 500 errors. How the new syntax works, how it handles arrays with precision, and how to migrate your controllers.
ruby
How to write custom RSpec matchers in your Ruby on Rails app
Custom RSpec matchers turn repetitive assertions into readable, reusable specs. Step by step: define a matcher with RSpec::Matchers.define, add clear failure messages, build flexible matchers that take arguments, and wire them into your Rails test suite.
Latest
What's new in Ruby 3.4
Ruby 3.4 adds the new 'it' block parameter that makes .then chains and maps cleaner than numbered parameters, chilled strings as a step toward immutability, and enhanced Range operations. What each change looks like in practice, with before and after code.
Mastering database enums in Rails with Postgres - Guide
Database enums in PostgreSQL give Rails apps type safety, implicit ordering, and faster queries than string columns. Single-value enums with validation, multi-select enum arrays, dynamic enum management, and the migrations that wire it all together.
How to run Rails console in safe sandbox mode?
Rails console sandbox mode wraps every database operation in a transaction and rolls it all back on exit, so you can experiment safely. How to launch it, plus the traps: database locking, non-rollbackable operations, and why production use still needs care.
Dealing with legacy code that uses different method naming conventions
Legacy services with mismatched method names (validate, execute!, run!) can be unified with Ruby method objects. How to build one dispatcher that calls the right method on each class, why it beats conditionals, and what it does for readability.
How to get table size in PostgreSQL database?
PostgreSQL table size is more than the data: pg_table_size, pg_indexes_size, and pg_total_relation_size each measure different things. One ready SQL query lists every table with data, index, and total size, sorted by the biggest disk consumers first.
What is Frugal architecture?
Frugal Architecture is Werner Vogels' framework for cost-conscious system design: three pillars (Design, Measure, Optimize) and seven laws, from treating cost as a non-functional requirement to continuous optimization, explained with practical examples.
The Truth About Password Security: Beyond Special Characters
Password security depends on entropy, not special characters. The math behind entropy = N * log2(R), why length beats complexity rules, why database breaches (not login guessing) are the real threat, and implementation tips for saner password policies.
How to listen to Rails events
ActiveSupport::Notifications lets you listen to Rails events like transaction.active_record without extra gems. How the instrumentation API works, subscribing to built-in Rails events, and publishing your own custom events for better observability.
Securing your iOS app or webpage app in Safari with HTTPS: A guide to local SSL certificates
HTTPS for local iOS development with mkcert: generate a local certificate authority, create SSL certificates for your dev domains, and install the root certificate on a simulator or real device so Safari and your native app trust your local Rails server.
Mastering Ruby's argument handling: positional, keyword, and the magic of three dots
Ruby argument handling explained: positional arguments with *args, keyword arguments with **kwargs, and the three-dot syntax from Ruby 2.7 that forwards everything at once. Code examples for each, plus guidance on when each style keeps methods readable.
Dockerizing NextJS for development - Quickstart guide
Dockerize NextJS development with docker-compose watch: sync ./src into the container, rebuild on dependency changes, and keep hot reload working. A complete docker-compose.yml and Dockerfile you can copy for a reproducible dev environment in minutes.
Streamlining Rails controllers with custom filters
Rails controllers bloated with subscription checks? Extract that logic into custom filter classes: a before_action that delegates to a dedicated object, giving cleaner controllers, clearer error messages, easier testing, and a pattern you can expand.
CSS units - which one should be used and when
CSS units decide how responsive and accessible your site is. A practical tour of px, em, rem, vh, vw and friends: what absolute, relative, and viewport based units really do, plus a short opinionated guide on which unit to pick for fonts, spacing, and layout.
What is the difference between Layout and Template in NextJS
Layout and template in NextJS look interchangeable but behave differently: a layout preserves state across navigation while a template remounts and rebuilds it on every visit. Code examples of both, plus guidance on when each one is the right choice.
How to deep equal in Javascript?
Deep equality in JavaScript is trickier than it looks: JSON.stringify fails when key order differs. Compare the real options: the deep-equal package, writing your own recursive check, lodash isEqual, and Node's built-in assert.deepStrictEqual.
What is Turbo Frames in Rails?
Turbo Frames let Rails reload just a fragment of the page instead of the whole thing, with no custom JavaScript. What Turbo Frames are within Hotwire, a practical example of wrapping views in frames, and the responsiveness gains you get almost for free.
BiomeJS - A 35x faster alternative to Prettier for formatting and linting
BiomeJS formats and lints JavaScript, TypeScript, JSX, and JSON up to 35x faster than Prettier, with almost 97% compatibility. How to install it, migrate your Prettier config to biome.json, and cut minutes off CI without changing how your code looks.
Event bubbling in Javascript and React
Event bubbling in JavaScript and React: how a click travels from the target element up the DOM tree, what benefits that gives you, and why React does not really bubble events but simulates them with its synthetic event system.
What is THIS word in Javascript
What 'this' means in JavaScript: why its value depends on how a function is called, how setTimeout callbacks break your assumptions, and how bind, call, and apply put you back in control, shown with simple Dog and Cat examples.
Event Loop in Javascript with examples
The JavaScript event loop explained with examples: how the single-threaded call stack executes tasks, where Web APIs take over timeouts and API calls, and how the event loop decides what runs next in the non-blocking I/O model.