makandra dev

Next time you have to do more than trivial CSS changes on a project, you probably want to have live...

Did you know you can do in-place batch processing with plain ruby? The following script will in-place replace...

This card shows how to upgrade a Rails 2 application from Rails 2.3.8 through every single patch level up to...

The Rails secret_token must be unique for each application and any instance of it. If not, someone could exploit...

Merge requests are often rejected for similar reasons. To avoid this, before you send a merge request, please confirm that...

Do it like this: attribute :active, Virtus::Attribute::Boolean Long story In Virtus you define attribute with their type...

github.com

Essential backports that enable many of the nice features of Ruby 1.8.7 up to 2.0.0 for earlier versions.

The Ruby on Rails security list archive can be found here: http://groups.google.com/group/rubyonrails-security You can subscribe to this mailing...

robotlibrarian.billdueber.com

As Bill Dueber has on his blog, you can call rvm in the shebang to select a Ruby version like...

railway.at

Note: These instructions are for a quick per-project setup and may require you to change code. If you generally...

You can detect city and country from an IP address by using the GeoLite database. This is a flat file...

When you download or upgrade RVM it has a hardcoded notion which patch level it considers to be "1.9.3".

tl;dr: Ruby's Bundler environment is passed on to system calls, which may not be what you may want...

github.com

When using the json gem, you might run into this error when using JSON.parse: >> json = 'foo'.to_json >> JSON.parse(json...

makandra dev
aaronlasseigne.com

All Rubyists should be familiar with the common definitions for include and extend. You include a module to add instance...

nt.ntnu.no

yaml4r is a juxtaposition of yaml documents and their Ruby couterpart. Thus, it does a great job as YAML-doc...

makandra dev

Ever wondered about the difference between def and define_method? Turns out there are three implicit contexts in Ruby. def...

The way Rational#to_s works on Ruby has changed from Ruby 1.9 on. Here is how to get the...

tenderlovemaking.com

In Ruby, the meaning of protected and private is different from other languages like Java. (They don't hide methods...

stackoverflow.com

Access the Method object Dead simple: Get the method object and ask for its owner: "foo".method(:upcase) # => #

For example if you use rvm and get this message: ERROR: Loading command: install (LoadError) no such file to load...

Consider this class: class Foo private def test puts "Hello" end end While you can say create a block to...

Ruby 1.8 (supplied by Rails' ActiveSupport) >> BigDecimal.new("0.1").floor.class => BigDecimal Ruby 1.9 (supplied by Ruby 1.9 itself) >> BigDecimal.new("0.1").floor.class...

jeff.dallien.net

When you use heredoc, string interpolation is enabled by default: x = "Universe" <<-MESSAGE Hello #{x} MESSAGE # => "Hello Universe"