api.rubyonrails.org

Rails offers a way to prepend (or append) view paths for the current request. This way, you can make the...

Form fields can be rendered as noneditable by setting the disabled or the readonly attribute. Be aware of the differences...

Use bundler > 1.15 to fix Gem::LOADED_SPECS_MUTEX (NameError). Given the following project: ruby -v ruby 1.8.7

w3c.github.io

Here is how to use Chromedriver without libraries like selenium-webdriver. This can be useful for debugging. The following example...

web.archive.org

When flagging a spec that will be implemented later as pending, include a failing spec body or RSpec 3 will...

Note netstat has mostly been superseeded by its more modern rewrite ss which nowadays comes pre-installed rather than netstat...

ActiveSupport::Dependencies takes care of auto-loading any classes in development. This is usually useful, but when you run into...

To check which elements an ActiveRecord relation contains use the contain_exactly matcher. describe User do let!(:admin) { create(:user...

This is a small example on how you can check if your Postgres index can be used by a specific...

github.com

The issue: You are using stub_const to change a constant value for your test. stub_const "SomeClass::CONST", 'test...

makandracards.com

Rails applications and ruby gems should have a README that gives the reader a quick overview of the project. Its...

You should avoid using application models in your migrations. But how else could you create records in a migration?

Situation: You want to write a spec for a function inside an Angular service. This function at some point makes...

By default, browsers will not wrap text at syllable boundaries. Text is wrapped at word boundaries only. This card explains...

If your Angular app has some decent complexity, it will not be easy to use UI Router straight away. Here...

Git has two kind of tags: annotated lightweight Annotated tags are stored as full objects in the Git database. They...

Sometimes when working with VCR you still want to use webmock. Since VCR hooks into webmock and fails when an...

github.com

When you're using Sidekiq::Web to monitor the Sidekiq status AND have your session cookie configured to a wildcard...

requestb.in

Requestb.in is a webservice that gives you a temporary URL you can use to test request. The page will automatically...

We're usually running Ubuntu LTS versions. Sometimes newer hardware requires packages from more recent Ubuntu releases that only come...

A common pattern in Ruby is to to require all files in a specific diretory, using something like Dir.glob(Rails.root.join...

Checking if a JavaScript value is of a given type can be very confusing: There are two operators typeof and...

RSpec allows you to mark a single Example/ExampleGroup so that only this will be run. This is very useful when...

github.com

When an Rspec example fails, I usually investigate by running that example again using rspec . However, this does not work...