Ruby on rails


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Ruby on rails

  1. 1. Ruby on Rails ::The New Gem of Web Development
  2. 2. <ul><li>Web application framework </li></ul><ul><li>Dynamically typed programming language </li></ul><ul><li>Create or manage web applications which </li></ul><ul><ul><li>manipulate relational database from a web-based user interface </li></ul></ul>Ruby on Rails
  3. 3. Ruby ?? <ul><li>Pure object-oriented programming language </li></ul><ul><li>Everything is an object </li></ul><ul><li>Interpreted scripting language </li></ul><ul><li>Ruby successfully combines Smalltalk's conceptual elegance, </li></ul><ul><li>Python's ease of use and learning and Perl's pragmatism. </li></ul><ul><li>Ruby originated in Japan in 1993 by Yukihiro “matz” Matsumoto, </li></ul><ul><li>and has started to become popular worldwide in the past few </li></ul><ul><li>years as more English language books and documentation have </li></ul><ul><li>become available. </li></ul><ul><li>Ruby is a metaprogramming language. </li></ul>
  4. 4. What is Rails? Ruby on Rails or just Rails (RoR) <ul><li>An open source Ruby framework </li></ul><ul><li>Created by David Heinemeier Hansson – DHH Partner </li></ul><ul><li>The Rails framework was extracted from real-world web applications. </li></ul><ul><li>All layers in Rails are built to work together so you Don’t Repeat Yourself </li></ul><ul><li>Everything in Rails (templates to control flow to business logic) is written </li></ul><ul><li>in Ruby Except for configuration files - YAML </li></ul>
  5. 5. Rails Strengths – It’s all about Productivity <ul><li>Metaprogramming techniques </li></ul><ul><ul><li>Metaprogramming replaces these two primitive techniques and eliminates their disadvantages. </li></ul></ul><ul><ul><li>Ruby is one of the best languages for metaprogramming, and Rails uses this capability well. </li></ul></ul><ul><li>Scaffolding </li></ul><ul><ul><li>which can quickly construct most of the logic and views needed to do common operations, such as Create, Read, Update and Delete (CRUD). </li></ul></ul>
  6. 6. Rails Strengths – Write Code not Configuration <ul><li>Convention over configuration </li></ul><ul><ul><ul><li>Naming your data model class with the same name as the corresponding database table </li></ul></ul></ul><ul><ul><ul><li>‘ id’ as the primary key name </li></ul></ul></ul><ul><li>Rails introduces the Active Record framework, which saves objects to the database. </li></ul><ul><ul><ul><li>The Rails version of Active Record discovers the columns in a database schema and automatically attaches them to your domain objects using metaprogramming. </li></ul></ul></ul><ul><ul><ul><li>This approach to wrapping database tables is simple, elegant, and powerful. </li></ul></ul></ul>
  7. 7. Rails Strengths – Full-Stack Web Framework <ul><li>Rails implements the model-view-controller (MVC) architecture. The MVC design pattern separates the component parts of an application </li></ul>
  8. 8. <ul><li>For example </li></ul><ul><li>If there is a class Post, the following code: </li></ul><ul><ul><ul><li>a = </li></ul></ul></ul><ul><ul><ul><li>a.subject = &quot;Example message&quot; </li></ul></ul></ul><ul><ul><ul><li>a.body = &quot;This is an example message.&quot; </li></ul></ul></ul><ul><ul><ul><li>a.Save </li></ul></ul></ul><ul><li>INSERT INTO posts (subject, body) VALUES ('Example message', 'This is an example message.'); </li></ul>
  9. 9. b = Post.find(:all, :conditions => ['score > 80']) is conceptually equivalent to the following SQL command: SELECT * FROM posts WHERE score > 80;
  10. 10. Rails Strengths <ul><li>Three environments: development, testing, and production </li></ul><ul><li>Rails embraces test-driven development. </li></ul><ul><ul><li>Unit testing: testing individual pieces of code </li></ul></ul><ul><ul><li>Functional testing: testing how individual pieces of code interact </li></ul></ul><ul><ul><li>Integration testing: testing the whole system </li></ul></ul><ul><li>Database Support: Oracle, DB2, SQL Server, MySQL, PostgreSQL, SQLite </li></ul>Rails Application Directory Structure
  11. 11. Hello Rails! <ul><li>def sayGoodmorning(name) </li></ul><ul><li>result = &quot;GoodMorning,&quot; + name </li></ul><ul><li> return result </li></ul><ul><li>end </li></ul><ul><ul><ul><ul><li># Time for tea... </li></ul></ul></ul></ul><ul><li>puts sayGoodmorning(“Think ahead&quot;) </li></ul><ul><li>puts sayGoodmorning(“Think ahead &quot;) </li></ul>
  12. 12. Hello Rails! <ul><li>Out put is: </li></ul><ul><li>GoodMorning Think ahead </li></ul><ul><li>GoodMorning Think ahead </li></ul>
  13. 13. <ul><li>Rail’s two guiding principles: </li></ul><ul><ul><li>Less software (Don’t Repeat Yourself - DRY) </li></ul></ul><ul><ul><li>Convention over Configuration (Write code not configuration files) </li></ul></ul><ul><li>High Productivity and Reduced Development Time </li></ul>Summary
  14. 14. Its just like this
  15. 15. Thank you