Posted over 1 year ago by Dominik Schöler.

Code comments allow for adding human readable text right next to the code: notes for other developers, and for your...

Posted about 10 years ago by Henning Koch.

Here are some popular mistakes when using nested forms: You are using fields_for instead of form.fields_for.

Posted over 3 years ago by Dominik Schöler.

TL;DR Use the #remove_ ! method to delete attachments. Also, save the record after removing the file!

Posted over 7 years ago by Henning Koch.

Say you have a User with a Carrierwave attribute #avatar: class User < ActiveRecord::Base mount_uploader :avatar, AvatarUploader end

Posted about 9 years ago by Thomas Eisenbarth.

When requests arrive at the application servers simultaneously, weird things can happen. Sometimes, this can also happen if a user...

Posted almost 4 years ago by Arne Hartherz.

After loading a staging dump into development, you might get an ActiveRecord::EnvironmentMismatchError when trying to replace the database (like...

Posted over 1 year ago by Henning Koch.

We can use ActiveRecord's where to add conditions to a relation. But sometimes our condition is not on the...

Posted over 8 years ago by Henning Koch.

ActiveRecord has a feature called counter caching where the containing record in a has_many relationship caches the number of...

Posted over 10 years ago by Henning Koch. api.jquery.com

jQuery offers many different methods to move a selection through the DOM tree. These are the most important: $element.find(selector...

Posted almost 6 years ago by Henning Koch.

To safely transport an arbitrary string within a URL, you need to percent-encode characters that have a particular meaning...

Posted over 1 year ago by Judith Roth.

Or: How to avoid and refactor spaghetti code Please note that I tried to keep the examples small. The effects...

Posted over 1 year ago by Emanuel De.

This is a personal post-mortem analysis of a project that was mainly build to provide a REST API to...

Posted over 1 year ago by Emanuel De.

PostgreSQL and ActiveRecord have a good support for storing dynamic attributes (hashes) in columns of type JSONB. But sometimes you...

Posted over 6 years ago by Thomas Klemm. github.com

Capybara-screenshot can automatically save screenshots and the HTML for failed Capybara tests in Cucumber, RSpec or Minitest. Requires Capybara...

Posted almost 4 years ago by Emanuel De.

around(:suite) does not exist. around(:all) runs after before(:all) and before after(:all). around(:each) runs before...

Posted over 3 years ago by Henning Koch.

MySQL and MariaDB have an SQL mode setting which changes how MySQL behaves. The SQL mode value is comprised of...

Posted over 5 years ago by Dominik Schöler. stackoverflow.com

git rebase -i -> mark your commit with edit git reset HEAD~ (remove the marked commit, but keep its...

Posted over 8 years ago by Henning Koch.

Calling bundle update (without arguments) updates all your gems at once. Given that many gems don't care about stable...

This website uses short-lived cookies to improve usability.
Accept or learn more