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

When your site is on HTTPS and you are linking or redirecting to a HTTP site, the browser will not...

makandra dev

git shortlog -s -n [commit-range] -n, --numbered Sort output according to the number of commits per author

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

We ran into trouble when adding additional compute units to our railscomplete Hosting environment lately. VM-instances on the new...

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

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

This only works when you actually have a session ID (not the case for Rails' CookieStore, for example): request.session_options...

In specs, the session never persists but is always a new object for each request. Data put into the session...

apidock.com

All columns of a model's database table are automagically available through accessors on the Active Record object.

Note: This technique is confusing and slows down your test suite. Copy the attached code to features/support. This gets you...

stackoverflow.com

Usually, the logrotate service takes care of renaming log files each night or so to avoid logs becoming huge. That...

stackoverflow.com

When you use ab to do some performance benchmarking, you might run into output like this: Complete requests: 200

Find out in this short guide, how to horizontally center a absolute positioned container with CSS. Note: We have a...

Sometimes you might want to limit the number of associated records in a has_many association, but cannot add a...

The User-Agent HTTP header identifies the client and is sent by "regular" browsers, search engine crawlers, or other web...

Spreewald's patiently repeats the given block again and again until it either passes or times out.

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

Unfortunately, Capybara does not offer a switch to disable cookies in your test browser. However, you can work around that...

To set a cookie in your test browser for cucumber tests, you need to know which driver you are using...