
Delete table
Suppose you want to remove a 'comments' table from a blog application. You can do so by performing the following tasks from the command line (e.g., Terminal). Step one: $ rails console Step two: $ ActiveRecord::Migration.drop_table(:c...
Answer 1 In Ruby, nil in an object (a single instance of the class NilClass) so methods can be called on it. nil? is a standard method in Ruby that can be called on all objects and returns true for the nil object and false for anything else. emp...
The map method takes an enumerable object and a block, and runs the block for each element, outputting each returned value from the block (the original object is unchanged unless you use map!): [1, 2, 3].map { |n| n * n } #=> [1, 4, 9] Array ...
Download Ruby and install Check ruby installation: ruby -e "puts 1+1" -> 2 irb - for interactive ruby commands Download devkit for corresponding ruby version and extract to c:\devkit Browse to c:\devkit and run this: ruby dk.rb init type...
Development Install Ruby Install DevKit (http://rubyinstaller.org/downloads/) gem install capistrano --no-ri --no-rdoc Deployment Machine Update the software sources list And upgrade the dated applications: aptitude update aptitud...