Getting a regular expression from a string in JavaScript is quite simple: new RegExp('Hello Universe'); # => /Hello Universe/
We have often felt the pain where our models need to serve too many masters. E.g. we are adding a...
In the following example the method update_offices_people_count won't be called when office_id changes, because it...
Awesome battle report from Pinterest trying to scale their setup using different approaches. When you push something to the limit...
In specs, the session never persists but is always a new object for each request. Data put into the session...
All columns of a model's database table are automagically available through accessors on the Active Record object.
yaml4r is a juxtaposition of yaml documents and their Ruby couterpart. Thus, it does a great job as YAML-doc...
The User-Agent HTTP header identifies the client and is sent by "regular" browsers, search engine crawlers, or other web...
Ever wondered about the difference between def and define_method? Turns out there are three implicit contexts in Ruby. def...
The way Rational#to_s works on Ruby has changed from Ruby 1.9 on. Here is how to get the...
When a controller action redirects to an external URL (like http://somehost.com/some/path) you will find that this is hard...
In Ruby, the meaning of protected and private is different from other languages like Java. (They don't hide methods...
Access the Method object Dead simple: Get the method object and ask for its owner: "foo".method(:upcase) # => #
Rails flashes (FlashHash) track a list of used keys, which is not respected when comparing flash hashes.
Smashing Magazine lists some handy tricks for print style sheets, all with CSS: Expand External Links For Print
The linked site lists a wealth of CSS hacks that let you apply styles to just that one browser. You...
Rails understands a :limit options when you create columns in a migration. Its meaning depends on the column type, and...
tl;dr: Do not use merge! for session hashes. Use update instead. Outline Let's assume you're modifying the...
JavaScript has no built-in functions to compare two objects or arrays for equality of their contained values.
Ruby 1.9 changed the default behavior of Module.const_defined? from what it was in Ruby 1.8 -- this can be especially...
Rails 2.3.16+ on Ruby 1.9 causes warnings like this: .../gems/activesupport-2.3.17/lib/active_support/core_ext/string/output_safety.rb:22: warning: regexp match /.../n against to UTF-8 string...
If you need to capture signatures on an IPad or similar device, you can use Thomas J Bradley's excellent...
So you're using multiple remotes that offer the same branch? $ git branch -a | grep my-branch remotes/something/my-branch remotes/origin/my-branch
You either have an old version of Mocha and an edge version of Rails 3.2, or you have a new...