Rails migrations allow you to use a change method whose calls are automatically inverted for the down path. However, if...
For our production servers we use Passenger as a Ruby application server. While it is possible to use Passenger for...
Cucumber allows for prose in features and scenarios. Example: Feature: Cancel account There are several ways to cancel a user...
In a JavaScript console, type this: > 9112347935156469760 9112347935156470000 Ooops. And that's not a float! This occurs because JavaScript uses...
Creating records in specs can be so fast that two records created instantly after one another might have the same...
Cookies without an expiration timestamp are called "session cookies". [1] They should only be kept until the end of the...
Capybara will fail to find tags that are missing an href attribute. This will probably happen to you every now...
Due to network or hardware failures, it can happen that one of your cronjobs will not run at the time...
Safari on iOS accepts an apple-touch-icon favicon that is used for stuff like desktop bookmarks. Always define a...
This card describes how to pass an array with multiple element to a JavaScript function, so that the first array...
When you have a string containing umlauts which don't behave as expected (are not matched with a regexp, can...
better_errors is an awesome gem for enhanced error pages in development, featuring a live-REPL for some light debugging...
Your development machine is usually on a very good network connection. To test how your application behaves on a slow...
By default, Rails' validates_uniqueness_of does not consider "username" and "USERNAME" to be a collision. If you use MySQL...
When you call a method on an object, Ruby looks for the implementation of that method. It looks in the...
Using git checkout - you can switch back to the branch you previously worked on. (master) $ git checkout foobar
Wondering how a specific method on an object is exactly named? You can use Enumerable#grep to detect it in...
Like in any language, a FLOAT will eventually corrupt data due to rounding errors. Please use DECIMAL, which has well...
Tests are about 100% control over UI interaction and your test scenario. Randomness makes writing tests hard. You will also...
Sometimes you have a test expectation but actually want a better error message in case of a failure. Here is...
What Rails version Within before_* Within after_* Cancel later callbacks Rails 1-4 return false return false Cancel later callbacks...
Say you have a User with a Carrierwave attribute #avatar: class User < ActiveRecord::Base mount_uploader :avatar, AvatarUploader end
Whenever you create a table from a database migration, remember to add updated_at and created_at timestamps to that...
When two classes implement the same behavior (methods, callbacks, etc.), you should extract that behavior into a trait or module...