Posted over 7 years ago by Henning Koch.

When you call a method on an object, Ruby looks for the implementation of that method. It looks in the...

Posted about 1 year ago by Henning Koch. thoughtbot.com

One of the earliest pieces of wisdom we are given as programmers is to not write duplicate code: Don’t...

Posted about 1 year ago by Emanuel De.

This seems to be obvious, but you can expect Rake tasks to be called in RSpec. it 'deletes all Users...

Posted about 3 years ago by Dominik Schöler. guides.rubyonrails.org

TL;DR Append your locale keys with _html to have them marked as html_safe. When you're localizing a...

Posted about 1 year ago by Emanuel De.

Using git fixup helps you to speed up appending changes further back in the git history of your feature branch...

Posted over 8 years ago by Henning Koch.

Calling bundle update GEMNAME will update a lot more gems than you think. E.g. when you do this...

Posted over 3 years ago by Henning Koch.

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

Posted over 10 years ago by Henning Koch.

Sometimes it is useful to define a named scope by implementing a static method with the scope's name on...

Posted almost 10 years ago by Henning Koch.

When your Cucumber feature needs to browse the page HTML, and you are not sure how to express your query...

Posted almost 5 years ago by Arne Hartherz.

By convention, common protocols use a defined port, like 80 for HTTP or 443 for HTTPS. You can use nmap...

Posted over 6 years ago by Thomas Klemm.

Creating records in specs can be so fast that two records created instantly after one another might have the same...

Posted about 1 year ago by Emanuel De.

You can install rubygems 3.0.8 (released on February 18, 2020) to keep all the Gem::Specification#rubyforge_project deprecation warnings...

Posted about 1 year ago by Arne Hartherz.

When you have many changes, and you want to spread them across different commits, here is a way to stage...

Posted about 6 years ago by Arne Hartherz.

Several Rails migration methods accept index: true as an option to create an index. In some cases (like #add_column...

Posted over 6 years ago by Henning Koch.

Here is a Javascript function reloadUsers() that fetches a HTML snippet from the server using AJAX and replaces the current...

Posted almost 4 years ago by Emanuel De. docs.ruby-lang.org

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

Posted about 1 year ago by Michael Leimstädtner. github.com

...person (Josh Branchaud). It includes an extensive list of over 900 TILs on many topics that might be interesting for most of us. (e.g. Ruby, Rails, Git, Unix..) Ruby

...to grab both the key and value from a hash Rerun Only Failures With RSpec RSpec can be configured to run only failed specs: RSpec.configure do |config| config.example_status_persistence...

Posted about 1 year ago by Emanuel De. millarian.com

In Active Record you can use named bindings in where-conditions. This helps you to make your code more readable...

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