The quick and dirty. Including a Ruby Module is for instance methods and extending is for inheriting class variables in your classes. 1) Here is include module Pizza def self.included(base) base.extend(ClassMethods) end   module ClassMethods def style puts ‘wood fired’ end end   def arugula puts ‘true’ end end   class Restaurant include Pizza end   # Calling a class method => wood fired   # Calling an instance => true   # Calling a instance as a class Restaurant.arugula # NoMethodError: undefined method ‘arugula’ for Restaurant:Class   # Calling a class method as an instance # NoMethodError: undefined method ‘style’ 2) Here is extend   class Restaurant extend Pizza end   # Calling the same instance[…]

Using interpolated YML and a little logic you can clean up your Rails Database.yml file. The default Rails Database.yml file. # SQLite version 3.x # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile # gem ‘sqlite3’ development: adapter: mysql2 database: appname_development username: root pool: 5 timeout: 5000   # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: mysql2 database: appname_test username: root pool: 5 timeout: 5000 Here is a cleaner version login: &login username: root password:   defaults: &defaults pool: 2 wait_time: 5 reconnect: true encoding:[…]

Every time we need to process a hash in a method it can slow the response loop in Ruby. If you can assign your hash to a variable versus process the hash you can save time in expense methods. 1) Create the following test class named process_hash.rb   require ‘benchmark’   OPTIONS = {:id => 12321, :first_name => ‘Brett’, :last_name => "U"}   class HashTest   def process_input(options = {}) puts Benchmark.measure { options.rehash } end   def process_input_as_variable(options = {}) hash = options.rehash puts Benchmark.measure { hash } end   end   h1 = h1.process_input(OPTIONS)   h2 = h2.process_input_as_variable(OPTIONS) 2) The results   ➜ 52 ruby process_hash.rb 0.000000 0.000000 0.000000 ( 0.000012) 0.000000 0.000000 0.000000 ( 0.000006)[…]