Ruby
How to solve different problems with Ruby.
Practical answers for building with Ruby and Rails.
- How do I add character encoding to the Heroku buildpack? — Get charlock_holmes working on Heroku with a custom buildpack. → Read more
- How do I add image processing to the Heroku buildpack? — Compile image libraries for Rails image manipulation on Heroku. → Read more
- How do I bulk insert records that don’t already exist? — Upsert patterns with ActiveRecord and raw SQL. → Read more
- How do I cancel a Recurly subscription programmatically? — Use the Recurly Ruby SDK to cancel and manage subscriptions. → Read more
- How do I create a custom tag with attributes in Jekyll? — Parse and render custom Liquid tags with named parameters. → Read more
- How do I eager load children in ActiveRecord? — Use includes and preload to avoid N+1 queries. → Read more
- How do I fix a handlebars.vm include error? — Resolve gem version conflicts that cause runtime load errors. → Read more
- How do I fix the Psych YAML issue on RVM and macOS? — Fix path2class errors when RVM and Homebrew Ruby conflict. → Read more
- How do I flatten a hash into a string? — Convert nested hashes into flat key-value strings. → Read more
- How do I look up HTTP status codes in Rails? — Symbol and numeric status code reference for Rails controllers. → Read more
- How do I pass variables to a partial in Rails? — Use locals to send data from parent templates to partials. → Read more
- How do I recover from a load error? — Auto-install missing gems when a LoadError is raised. → Read more
- How do I use RSpec tips and tricks? — Run individual tests, bisect failures, and add detail to output. → Read more
- How do I run SQL in Rails migrations? — Execute raw SQL alongside schema changes in migration files. → Read more
- How do I set up a custom Ruby buildpack? — Add compilation steps to the standard Heroku Ruby buildpack. → Read more
- How do I get the size of an ActiveRecord collection? — Count, length, and size — when to use each method. → Read more
- How do I convert a string to a class reference? — Use constantize and safe_constantize for dynamic class lookup. → Read more
- How do I get unique records from a list? — Deduplicate ActiveRecord result sets while preserving objects. → Read more
- How do I URL-encode a string in Ruby? — Encode query parameters and form data using standard library methods. → Read more
- How do I use modules for testing? — Mock behavior by including test modules instead of full mocking frameworks. → Read more