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

github.com

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

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

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

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

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

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

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

Since Rails 5, domain models inherit from ApplicationRecord by default. This is the place to put code that should be...

Rails supports time zones, but there are several pitfalls. Most importantly because Time.now and Time.current are completely different things and...

makandra dev
stdgems.org

Ruby's standard library is in the process of being gemified. It will soon - Ruby 2.5 - consist of RubyGems, which...

Middleman is a static page generator that brings many of the goodies that Rails developers are used to.

Dump this method into your Ruby console to quickly print data in columns. This is helpful for e.g. comparing attributes...

chris.beams.io

Separate subject from body with a blank line Limit the subject line to 50 characters (max. 72), include...

Database connections are not thread-safe. That's why ActiveRecord uses a separate database connection for each thread.

makandra dev

This card compares patterns to store trees in a relation database like MySQL or PostgreSQL. Implementation examples are for the...

When you load a dump for development, records may reference images that are not available on your machine.

The maximum version of Internet Explorer you can have depends on your version of Windows. E.g. Windows 7 users can...

makandra dev

This is a visualization of the files that will be generated by some useful rails generators. Invoke a generator from...