Monatsarchiv für Juli 2009

Ruby (on Rails) – Wirble – Pimp my IRB and Console

Montag, den 20. Juli 2009

Ever wanted a colored irb or script/console? Well, you should try wirble. It gives you a number of enhancements for Irb. Some of the features are: Tab completion Colorized results … Installation is easy as pie:  sudo gem install wirble vi .irbrc require ‘rubygems’ require ‘wirble’ # start wirble (with color) Wirble.init Wirble.colorize

Ruby Basics – * method arguments

Sonntag, den 19. Juli 2009

If you have ever asked yourself what is behind arguments like *this then here is the trivial answer: A small ruby script like this: #!/usr/bin/env ruby def my_method(a,b,*c) puts “a: ” + a puts “b: ” + b puts “c:” c.each { |ce| puts ce } end my_method(“a1″, “b2″, “c3″, “c4″, “c5″, “c6″) Produces the [...]

Ruby on Rails 2.3 – Nested Attributes with AJAX support

Sonntag, den 12. Juli 2009

Introduced in Rails 2.3 nested attributes help to shorten code if you want to edit multiple nested models within a single form. Here the corresponding article from the rails weblog: http://weblog.rubyonrails.org/2009/1/26/nested-model-forms There is also a very good tutorial on nested forms from Ryan Daigle: http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes Right now it seems as if there is no clean [...]

Rails 2.3 – Test Unit – undefined method `fixtures’ (NoMethodError) – undefined method `fixtures’

Donnerstag, den 9. Juli 2009

After switching to Rails 2.3 you might receive the following error messages while executing your TestUnit tests: undefined method `fixtures’ (NoMethodError) and/org undefined method `fixtures’ The solution to this is to change the class in test/test_helper.rb from Test::Unit::TestCase to ActiveRecord::TestCase. You will need to apply this change to all Tests inheriting for the  Test::Unit::TestCase class.