I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. at is the primary purpose of Ruby language.” “
… if it walks like a duck and talks like a duck, it’s a duck, right? So if this duck is not giving you the noise that you want, you’ve got to just punch that duck until it returns what you expect.” “
class Greeter def method_missing(name, *args) name = name.to_s if name =~ /^hello_/ puts "Hello, #{name.gsub(/^hello_/, '')}!" else super end end end Greeter.new.hello_john # => "Hello, john!"
class Account < ActiveRecord::Base # Returns all accounts with unread messages. def self.with_unread_messages joins(:messages).merge(Message.unread) end end