When you want to group rails models of a logical context, namespaces are your friend. However, if you have a...

RSpec allows defining methods inside describe/context blocks which will only exist inside them. However, classes (or any constants, for that...

github.com

FactoryBot allows a :class option to its factory definitions, to set the class to construct. However, this option is not...

There are several gems that make it easy to read and process xlsx files. Parsing the entire file at once...

When localizing model attributes via I18n you may run into errors like this: I18n::InvalidPluralizationData: translation data {...

...} can not be...

If another session is accessing your database you are trying to reset or drop you might have seen the following...

askubuntu.com

You need to disable "Bluetooth low energy", then follow these core steps: Make sure the headphones are in pairing mode...

docs.ruby-lang.org

Use return to return from a method. return accepts a value that will be the return value of the...

I frequently find myself needing a combination of group_by, count and sort for quick statistics. Here's a method...

before(:all) runs the block once before all of the examples. before(:each) runs the block once before each...

There are many approaches out there how you can import data from a legacy application to a new application. Here...

sitepoint.com

Scope is all about where something is visible. It’s all about what (variables, constants, methods) is available to you...

You should prefer native promises to jQuery's Deferreds. Native promises are much faster than their jQuery equivalent. Native promises...

Native promises have no methods to inspect their state. You can use the promiseState function below to check whether a...

You can use local copies of gems in your Gemfile like this: gem 'spreewald', path: '~/gems/spreewald' As soon as you...

github.com

rack-cargo gives your API a new /batch route that lets clients perform multiple API calls with a single request...

Sometimes you add Paperclip image styles, sometimes you remove some. In order to only keep the files you actually need...

makandra dev

In the ruby shell (IRB) and rails console the return value of the previous command is saved in _ (underscore). This...

I often see the use of || to set a default value for a variable that might be nil, null or...

You can not use the hash_including argument matcher with a nested hash: describe 'user' do let(:user) { {id: 1...

Capybara clears cookies before each scenario, but not other client-side data stores. If your app is using localStorage or...

ActiveRecord::RecordNotFound errors provide quite meaningful error messages that can provide some insight on application details. Consider the following:

api.rubyonrails.org

Rails 5 (don't know about the others) comes with an initializer wrap_parameters.rb. Here you can tell rails to wrap...

Webpack is the future. We're using it in our latest Rails applications. For tests, we want to compile assets...