github.com

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

github.com

Use Traim to build a RESTful API for your ActiveRecord models with very little code. Traim assumes your API resources...

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

ImageMagick can automatically crop surrounding transparent pixels from an image: convert input.png -trim +repage output.png

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

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

Put the line below in the respective env.rb file to make your action controllers raise an ActionController::UnpermittedParameters error when...

When using geordi for integration tests you might get the following error when trying to run geordi cucumber:

First, go to the webinterface of your phone. Choose Software Update in the navigation on the left. Next, you have...

You can configure a Ubuntu system as a gateway in order to share it's internet connection (maybe via WLAN...

select2 is a great jQuery library to make (large) fields more usable. For Bootstrap 3 there is select2-bootstrap-theme...

Capistrano has the concept of a "rollback" that comes in really handy in case of errors. When you notice that...

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

I needed to make sure that an element is visible and not overshadowed by an element that has a higher...

github.com

When storing a file with Carrierwave, it is always cached prior to actually storing it (to support form roundtrips).

This card will show you a cool way to define a class using Struct.new. A common usecase for Structs are...

Rails default config uses the ActiveSupport::Cache::NullStore and disables controller caching for all environments except production: config.action_controller.perform_caching = false...

makandra dev

If you use the Better Errors gem, you will sometimes notice that it can be very slow. This is because...

Shoulda Matchers don't provide canditional validations (validations with if: option). Here is how to write tests for the condition...

When using GROUP BY, MySQL now complains if the SELECT includes columns which are not part of the GROUP BY...

Nowadays it is fairly easy to intercept and modify mails globally before they are sent. All you have to do...