Running "bundle update" without arguments might break your application

Posted Over 11 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...

RVM: Get rid of your system Ruby

Posted Over 11 years ago by Henning Koch.

If you worked with a system Ruby before switching to RVM, this system Ruby will be in your way when...

Ruby: How to ensure a Tempfile's extension

Posted Over 11 years ago by Arne Hartherz.
ruby-doc.org

If you use Tempfile and pass your own filename containing an extension, it will just be consumed by the Tempfile...

How to get the hostname of the current machine in Rails or a Ruby script

Posted Over 11 years ago by Arne Hartherz.

Use Socket.gethostname. So for a machine whose hostname is "happycat", it will look like this: >> Socket.gethostname => "happycat" That should work...

will_paginate can paginate plain Ruby arrays

Posted Over 11 years ago by Henning Koch.

While you are probably using will_paginate to paginate ActiveRecord scopes, it can actually paginate plain Ruby arrays. The resulting...

Rails 4 Countdown to 2013 | The Remarkable Labs Blog

Posted Over 11 years ago by Henning Koch.
blog.remarkablelabs.com

With the impending release of Ruby on Rails 4, it looks like a lot of developers will be updating their...

King of Nothing, the DCI paradigm is a scam

Posted Over 11 years ago by Henning Koch.
elmcitycraftworks.org

I’ve worked on huge applications in Ruby and Rails before. I very much want to believe in DCI, but...

Helper methods - RSpec Core

Posted Over 11 years ago by Henning Koch.
relishapp.com

You can define methods in any example group using Ruby's def keyword or define_method method. These helper methods...

Everything you ever wanted to know about constant lookup in Ruby

Posted Over 11 years ago by Henning Koch.
cirw.in

If you ever wondered why a constant wasn't defined or wasn't available where you expected it to be...

How to package a non-Ruby file into a gem

Posted Over 11 years ago by Henning Koch.
github.com

Great solution in a GitHub issue.

byebug / ruby-debug: Find out current debugger position

Posted Over 11 years ago by Arne Hartherz.
blog.pivotal.io

So you are debugging like a boss and lost track of where you actually are in your code? No problem...

Zeus promises to make rails development faster

Posted Over 11 years ago by Dominik Schöler.
progfu.com

I am talking about development speed. When your application starts growing and you start adding gems, it starts to take...

Capybara 2.0 has been released

Posted Over 11 years ago by Ulrich Berkmueller.
github.com

The gem author Jonas Nicklas highlights in a Google Groups post that the release is not backwards compatible to 1...

Andand and SimpleDelegator

Posted Over 11 years ago by Tobias Kraze.

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

uninitialized constant MysqlCompat::MysqlRes (NameError)

Posted Over 11 years ago by Thomas Eisenbarth.

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

Rails: When to use :inverse_of in has_many, has_one or belongs_to associations

Posted Over 11 years ago by Henning Koch.

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

Capybara: evaluate_script might freeze your browser

Posted Over 11 years ago by Henning Koch.

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

Rubygems: Rebuild native extensions

Posted Over 11 years ago by Tobias Kraze.

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

Ruby: Extract the hostname from a URL

Posted Over 11 years ago by Henning Koch.
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...

Manually requiring your application's models will lead to trouble

Posted Over 11 years ago by Arne Hartherz.

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

Literally 101 Ruby tricks

Posted Over 11 years ago by Dominik Schöler.
speakerdeck.com

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

How Ruby lets you keep script and data in *one* file

Posted Over 11 years ago by Dominik Schöler.
shifteleven.com

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

Workaround for broken integer division after requiring the mathn library

Posted Over 11 years ago by Tobias Kraze.

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

Get rid of WARNING: Nokogiri was built against LibXML version 2.7.7, but has dynamically loaded 2.7.8

Posted Over 11 years ago.

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