Rails migrations allow you to use a change method whose calls are automatically inverted for the down path. However, if...

In a JavaScript console, type this: > 9112347935156469760 9112347935156470000 Ooops. And that's not a float! This occurs because JavaScript uses...

Cookies without an expiration timestamp are called "session cookies". [1] They should only be kept until the end of the...

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...

When you have a string containing umlauts which don't behave as expected (are not matched with a regexp, can...

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...

makandra dev

When you call a method on an object, Ruby looks for the implementation of that method. It looks in the...

Tests are about 100% control over UI interaction and your test scenario. Randomness makes writing tests hard. You will also...

Goal Within before_* Within after_* Cancel later callbacks throw :abort throw :abort Rollback the transaction throw :abort raise ActiveRecord::Rollback...

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...

Custom matchers are a useful RSpec feature which you can use to DRY up repetitive expectations in your specs. Unfortunately...

1. Saving files to a directory that is not shared between deploys or servers If you save your uploads to...

Merge requests are often rejected for similar reasons. To avoid this, before you send a merge request, please confirm that...

Sometimes you want git to ignore certain files that appear on your machine. You can do this in 3 ways...

When HTTP clients make an request they can define which response formats they can process. They do it by adding...

In the following example the method update_offices_people_count won't be called when office_id changes, because it...

Rails gives you migrations to change your database schema with simple commands like add_column or update. Unfortunately these commands...

Caution when using .where to exclude records from a scope like this: # Fragile - avoid User.where("id NOT IN (?)", excluded_ids...

Do not pass times to date attributes. Always convert times to dates when your application uses time zones. Background

JavaScript has no built-in functions to compare two objects or arrays for equality of their contained values.