The very useful andand gem does not play very nice with Ruby's SimpleDelegator (or vice versa). This following will...

If you get a stacktrace complaining about uninitialized constant MysqlCompat::MysqlRes a system library update might broke your gem.

perlstalker.vuser.org

While you can set your own font in your terminal or other tools, it will not change the default "Monospace...

The classical scenario: There's a parent div element and you want to center some arbitrary child element vertically inside...

When you have two models in a has_many, has_one or belongs_to association, the :inverse_of option in...

Capybara gives you two different methods for executing Javascript: page.evaluate_script("$('input').focus()") page.execute_script("$('input').focus()")

Rarely, you might want to rebuild all gems with native extensions, because they might be compiled against outdated system libraries...

YourClass.reflect_on_all_associations.map(&:name) Get the class name by calling class_name, or the type of the association (belongs_to, has_many...

Icon fonts like Font Awesome are infinitely scalable, look great on high-DPI displays and will give your app a...

Under certain (unknown) circumstances, Rails will give localized files an invalid content-type in the Response header. For me, after...

stackoverflow.com

url = 'http://www.foocorp.com/foo/bar' URI.parse(url).host # => www.foocorp.com Note that this will raise an error if the given argument is...

In theory you can take any scope and extend it with additional joins or conditions. We call this chaining scopes...

ActiveModel::Errors is used to handle validation errors on Rails objects. If you inspect an instance, it feels like a...

vimeo.com

Hashrocket Lunch n' Learn #1 with Avdi Grimm: Making Little Classes out of Big Ones A look at the pros...

If you require your Rails models manually, pay attention to the path you use. Unless you have...

If your application has forms to edit string fields, you probably want to strip the entered values (remove whitespace from...

blog.codeclimate.com

“Fat models” cause maintenance issues in large apps. Only incrementally better than cluttering controllers with domain logic, they usually represent...

makandra dev
github.com

Richard Powell presents a collection of CSS styling advice that's mainly taken from SMACSS. Although at makandra we're...

makandra dev
speakerdeck.com

The linked slidedeck holds many tips, of which I list the most interesting to me below DATA and END

shifteleven.com

The __END__ keyword tells Ruby where a file ends – but you don't have to stop there. Any text you...

Ruby's mathn library changes Fixnum division to work with exact Rationals, so 2 / 3 => 0 2 / 3 * 3 => 0...

If you get this warning on your local machine one of these steps might help: Rebuilt the gem with the...

Never ever declare your associations with a string, especially when doing metaprogramming. A common mistake is something like # WRONG

If this happens to you: user.avatar = Avatar.new user.avatar # => nil (where avatar is a belongs_to), you probably declared your association...