This page lists many query methods and options in ActiveRecord which do not sanitize raw SQL arguments and are not...
Stringex is a gem that offers some extensions to Ruby's String class. Ruby 1.9 compatible, and knows its way...
In our continued quest to extract proven code snippets from makandropedia into tested and upgradable gems, we have released Edge...
TLDR: Ruby class variables (@@foo) are dangerous in many ways. You should avoid them at all cost. See bottom of...
Ruby has two different ways to match the start and the end of a text: ^ (Start of line) and $ (End...
January has been a very bad month for Ruby on Rails developers, with two high-severity security bugs permitting remote...
If you have an integer and want to use it to represent an element's position (like "1st" for 1...
validates_uniqueness_of is not sufficient to ensure the uniqueness of a value. The reason for this is that in...
Calling bundle update GEMNAME will update a lot more gems than you think. E.g. when you do this...
Apache HTTP server benchmarking tool (ab) is a nice tool to test performance on sites delivered by HTTP. If the...
Use Socket.gethostname. So for a machine whose hostname is "happycat", it will look like this: >> Socket.gethostname => "happycat" That should work...
You will get this when you are using the latest version of Rails with a recent version of Rack:
Let’s take a look at what you need to do to get your app ready for Rails 4.
With the impending release of Ruby on Rails 4, it looks like a lot of developers will be updating their...
I’ve worked on huge applications in Ruby and Rails before. I very much want to believe in DCI, but...
Axlsx is an incredible gem to generate "Office Open XML" spreadsheet files (XLSX). Does not break on large spreadsheets and...
TLDR: In tests you need to clean out the database before each example. Use :transaction where possible. Use :deletion for...
When searching for text in a MySQL table, you have two choices: The LIKE operator FULLTEXT indexes (which currently only...
Basic error pages To add a few basic styles to the default error pages in Rails, just edit the default...
If - for whatever reason - you have to render stylesheets dynamically, the following snippet might be of help. It emulates what...
Our old solution for cronjobs, the "craken" plugin, is no longer maintained and does not work on Rails 3.2+.
You know that you can force absolute URLs throughout a response. Now you want to modify URLs similarly, but only...
ActiveRecord has a feature called counter caching where the containing record in a has_many relationship caches the...
In Rails 2, when calling instance_eval or instance_exec on a scope, the scope will fetch its records from...