“I always knew that one day
Smalltalk would replace Java. I
just didn’t know it would be called
Ruby.”
– Kent Beck, MountainWest RubyConf 2009
o   dynamic, reflective, general purpose object-oriented
    programming language
o   designed by Yukihiro "Matz" Matsumoto. It was influenced
    primarily by Perl, Smalltalk, Eiffel, and Lisp.
o   Ruby supports multiple programming paradigms, including
    functional, object oriented, imperative and reflective. It
    also has a dynamic type system and automatic memory
    management; it is therefore similar in varying respects to
    Python, Perl, Lisp, Dylan, Pike, and CLU.
o   alternative implementations of the Ruby language,
    including YARV, JRuby, Rubinius, IronRuby, MacRuby, and
    HotRuby, each of which takes a different approach, with
    IronRuby, JRuby and MacRuby providing just-in-time
    compilation and MacRuby also providing ahead-of-time
    compilation
o   open source web application framework for the Ruby
    programming language.
o   It is intended to be used with an Agile development
    methodology that is used by web developers for rapid
    development
o   Ruby on Rails was extracted by David Heinemeier Hansson
    from his work on Basecamp, a project management tool by
    37signals (now a web application company
o   David Hansson first released Rails as open source in July 2004
o By helping you know what the code in your
  application is doing
o By helping you do more in, and with, your Rails
  applications that you can if you limit yourself to the
  readily available Rails idioms and techniques
o By allowing you to familiarize yourself with the Rails
  source code, which in turn enables you to
  participate in discussions about Rails and perhaps
  submit bugs and patches.
o By giving you powerful tool for administrative and
  organization tasks connected with your application.
Ruby Concepts
Ruby for Rails
Rails Concepts
Hello RoR
First RoR App
Further reading
Ruby Concepts
Ruby for Rails
Rails Concepts
Hello RoR
First RoR App
Further reading
•   Thinking in Ruby
•   IRB
•   Hello World
Ruby Concepts
Ruby for Rails
Rails Concepts
Hello RoR
First RoR App
Further reading
Ruby Concepts
Ruby for Rails
Rails Concepts
Hello RoR
First RoR App
Further reading
•   Ruby Constructs
•   Importance of Ruby
•   Extending Rails and other
    frameworks
Ruby Concepts
Ruby for Rails
Rails Concepts
Hello RoR
First RoR App
Further reading
Ruby Concepts
Ruby for Rails
Rails Concepts
Hello RoR
First RoR App
Further reading
•   MVC
•   Server
•   Convention over Configuration
•   Structure of a Rails App
•   DRY(Don’t Repeat Yourself)
•   Migrations
•   Gems
•   Routes
•   And other topics
o  Stands for Model-View-Controller
o Model is responsible for maintaining the state of an
   application
o View layer provides the user interface
of an application
o   WEBrick
o   Mongrel

o   > ruby script/server
o   > gem server
o   All you need is common
    sense and it works like
    magic!
o   Comparison with C# ,
    Java
o   No Connection String
o   Another example of
    convention over
    configuration
o   Advantages
o   > ruby script/console
Implications of DRY in RoR ;
migrations , seeds etc.
1.   Migrations are a convenient way for you to alter your
     database in a structured and organized manner. You could
     edit fragments of SQL by hand but you would then be
     responsible for telling other developers that they need to go
     and run them. You’d also have to keep track of which
     changes need to be run against the production machines
     next time you deploy.
2.   db/schema.rb
3.   Timestamp
4.   Use of migrations in case of faulty code generation
class CreateProducts < ActiveRecord::Migration
def self.up
        create_table :products do |t|
          t.string :name
          t.text :description
          t.timestamps
        end
end
def self.down
        drop_table :products
end
end
> rake db:migrate
VERSION=<timestamp>

> ruby script/generate
migration
Add<Field>To<ContollerNam
e> fieldname:type
o   routes.rb
o    map.root
1.   > gem install <gem-name>
2.   > gem install <gem-name> --local
3.   > gem update –system
4.   > gem server
5.   From setup.rb … >ruby setup.rb
6.   From gemspec .. >gem build example.gemspec
7.   Get gemspecs / .gems form Rubyforge.com or
     github
8.   Rake gem:install
Hello RoR
http://rubyonrails.org
http://railsbrain.com
http://railscasts.com
http://asciicasts.com
http://github.com
o    Gourab Mitra
    gourab5139014@gmail.com
    http://gourabmitra.co.cc



o    Sujeet Kumar
    sujeet0s1@gmail.com
    http://bit.ly/aEFKTT
Ruby on Rails : First Mile

Ruby on Rails : First Mile

  • 1.
    “I always knewthat one day Smalltalk would replace Java. I just didn’t know it would be called Ruby.” – Kent Beck, MountainWest RubyConf 2009
  • 4.
    o dynamic, reflective, general purpose object-oriented programming language o designed by Yukihiro "Matz" Matsumoto. It was influenced primarily by Perl, Smalltalk, Eiffel, and Lisp. o Ruby supports multiple programming paradigms, including functional, object oriented, imperative and reflective. It also has a dynamic type system and automatic memory management; it is therefore similar in varying respects to Python, Perl, Lisp, Dylan, Pike, and CLU. o alternative implementations of the Ruby language, including YARV, JRuby, Rubinius, IronRuby, MacRuby, and HotRuby, each of which takes a different approach, with IronRuby, JRuby and MacRuby providing just-in-time compilation and MacRuby also providing ahead-of-time compilation
  • 5.
    o open source web application framework for the Ruby programming language. o It is intended to be used with an Agile development methodology that is used by web developers for rapid development o Ruby on Rails was extracted by David Heinemeier Hansson from his work on Basecamp, a project management tool by 37signals (now a web application company o David Hansson first released Rails as open source in July 2004
  • 6.
    o By helpingyou know what the code in your application is doing o By helping you do more in, and with, your Rails applications that you can if you limit yourself to the readily available Rails idioms and techniques o By allowing you to familiarize yourself with the Rails source code, which in turn enables you to participate in discussions about Rails and perhaps submit bugs and patches. o By giving you powerful tool for administrative and organization tasks connected with your application.
  • 7.
    Ruby Concepts Ruby forRails Rails Concepts Hello RoR First RoR App Further reading
  • 8.
    Ruby Concepts Ruby forRails Rails Concepts Hello RoR First RoR App Further reading
  • 9.
    Thinking in Ruby • IRB • Hello World
  • 10.
    Ruby Concepts Ruby forRails Rails Concepts Hello RoR First RoR App Further reading
  • 11.
    Ruby Concepts Ruby forRails Rails Concepts Hello RoR First RoR App Further reading
  • 12.
    Ruby Constructs • Importance of Ruby • Extending Rails and other frameworks
  • 13.
    Ruby Concepts Ruby forRails Rails Concepts Hello RoR First RoR App Further reading
  • 14.
    Ruby Concepts Ruby forRails Rails Concepts Hello RoR First RoR App Further reading
  • 15.
    MVC • Server • Convention over Configuration • Structure of a Rails App • DRY(Don’t Repeat Yourself) • Migrations • Gems • Routes • And other topics
  • 16.
    o Standsfor Model-View-Controller o Model is responsible for maintaining the state of an application o View layer provides the user interface of an application
  • 17.
    o WEBrick o Mongrel o > ruby script/server o > gem server
  • 18.
    o All you need is common sense and it works like magic! o Comparison with C# , Java o No Connection String
  • 19.
    o Another example of convention over configuration o Advantages o > ruby script/console
  • 20.
    Implications of DRYin RoR ; migrations , seeds etc.
  • 21.
    1. Migrations are a convenient way for you to alter your database in a structured and organized manner. You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run them. You’d also have to keep track of which changes need to be run against the production machines next time you deploy. 2. db/schema.rb 3. Timestamp 4. Use of migrations in case of faulty code generation
  • 22.
    class CreateProducts <ActiveRecord::Migration def self.up create_table :products do |t| t.string :name t.text :description t.timestamps end end def self.down drop_table :products end end
  • 23.
    > rake db:migrate VERSION=<timestamp> >ruby script/generate migration Add<Field>To<ContollerNam e> fieldname:type
  • 24.
    o routes.rb o map.root
  • 25.
    1. > gem install <gem-name> 2. > gem install <gem-name> --local 3. > gem update –system 4. > gem server 5. From setup.rb … >ruby setup.rb 6. From gemspec .. >gem build example.gemspec 7. Get gemspecs / .gems form Rubyforge.com or github 8. Rake gem:install
  • 27.
  • 30.
  • 31.
    o Gourab Mitra gourab5139014@gmail.com http://gourabmitra.co.cc o Sujeet Kumar sujeet0s1@gmail.com http://bit.ly/aEFKTT

Editor's Notes

  • #5 Matz ,
  • #6 Basecamp
  • #10 Thinking inRuby : Just the psychology behind ruby. What its meant to be? Conceptual elegance.