of 15 /15
copyrights TA Interactive. Ruby on Rails ::The New Gem of Web Development

Ruby on rails

Embed Size (px)

DESCRIPTION

 

Text of Ruby on rails

  • 1. Ruby on Rails::The New Gem of Web Development

2.

  • Web application framework
  • Dynamically typed programming language
  • Create or manage web applications which
    • manipulate relational database from a web-based user interface

Ruby on Rails 3. Ruby ??

  • Pure object-oriented programming language
  • Everything is an object
  • Interpreted scripting language
  • Ruby successfully combines Smalltalk's conceptual elegance,
  • Python's ease of use and learning and Perl's pragmatism.
  • Ruby originated in Japan in 1993 by Yukihiro matz Matsumoto,
  • and has started to become popular worldwide in the past few
  • years as more English language books and documentation have
  • become available.
  • Ruby is a metaprogramming language.

4. What is Rails? Ruby on Rails or just Rails (RoR)

  • An open source Ruby framework
  • Created by David Heinemeier Hansson DHH Partner
  • The Rails framework was extracted from real-world web applications.
  • All layers in Rails are built to work together so you Dont Repeat Yourself
  • Everything in Rails (templates to control flow to business logic) is written
  • in Ruby Except for configuration files - YAML

5. Rails Strengths Its all about Productivity

  • Metaprogramming techniques
    • Metaprogramming replaces these two primitive techniques and eliminates their disadvantages.
    • Ruby is one of the best languages for metaprogramming, and Rails uses this capability well.
  • Scaffolding
    • which can quickly construct most of the logic and views needed to do common operations, such as Create, Read, Update and Delete (CRUD).

6. Rails Strengths Write Code not Configuration

  • Convention over configuration
      • Naming your data model class with the same name as the corresponding database table
      • id as the primary key name
  • Rails introduces the Active Record framework, which saves objects to the database.
      • The Rails version of Active Record discovers the columns in a database schema and automatically attaches them to your domain objects using metaprogramming.
      • This approach to wrapping database tables is simple, elegant, and powerful.

7. Rails Strengths Full-Stack Web Framework

  • Rails implements the model-view-controller (MVC) architecture.The MVC design pattern separates the component parts of an application

8.

  • For example
  • If there is a class Post, the following code:
      • a = Post.new
      • a.subject = "Example message"
      • a.body = "This is an example message."
      • a.Save
  • INSERT INTO posts (subject, body)VALUES ('Example message', 'This is anexample message.');

9. b = Post.find(:all, :conditions => ['score > 80'])is conceptually equivalent to the following SQL command: SELECT * FROM posts WHERE score > 80; 10. Rails Strengths

  • Three environments: development, testing, and production
  • Rails embraces test-driven development.
    • Unit testing: testing individual pieces of code
    • Functional testing: testing how individual pieces of code interact
    • Integration testing: testing the whole system
  • Database Support: Oracle, DB2, SQL Server, MySQL, PostgreSQL, SQLite

Rails Application Directory Structure 11. Hello Rails!

  • def sayGoodmorning(name)
  • result = "GoodMorning," + name
  • return result
  • end
        • # Time for tea...
  • puts sayGoodmorning(Think ahead")
  • puts sayGoodmorning(Think ahead ")

12. Hello Rails!

  • Out put is:
  • GoodMorning Think ahead
  • GoodMorning Think ahead

13.

  • Rails two guiding principles:
    • Less software (Dont Repeat Yourself - DRY)
    • Convention over Configuration (Write code notconfiguration files)
  • High Productivity and Reduced Development Time

Summary 14. Its just like this 15. Thank you