When you need to find out in which kind of spec you are during run-time, it's definitely possible...
Sometimes you need a piece of code to do something different for specs than for features. If you don't...
Sometimes you want git to ignore certain files that appear on your machine. You can do this in 3 ways...
Note: These instructions are for a quick per-project setup and may require you to change code. If you generally...
Issue this command: sqlite3 ~/Library/Application\ Support/Dock/*.db "DELETE from apps WHERE title='APP_NAME';" && killall Dock This tells sqlite3 to...
When HTTP clients make an request they can define which response formats they can process. They do it by adding...
Authentication is hard: there are many edge cases, and most users (including yourself) usually only go the "happy path" once...
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...
You can detect city and country from an IP address by using the GeoLite database. This is a flat file...
tl;dr: Ruby's Bundler environment is passed on to system calls, which may not be what you may want...
Rails gives you migrations to change your database schema with simple commands like add_column or update. Unfortunately these commands...
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.
What you copy may not be what you see in the browser. Here is an online tool to determine the...
Note: This technique is confusing and slows down your test suite. Copy the attached code to features/support. This gets you...
Rails’ reputation as a relatively secure Web framework is well deserved. Out-of-the-box, there is protection against many...
Spreewald's patiently repeats the given block again and again until it either passes or times out.
Unfortunately, Capybara does not offer a switch to disable cookies in your test browser. However, you can work around that...
The following code doesn't work like expected: page.find(css_selector).find(other_css_selector) The second .find will search...
Great presentation about writing Javascript like you write everything else: Well-structured and tested. JavaScript is no longer a toy...
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