Ruby On Rails Siddhesh

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Ruby On Rails Siddhesh - Presentation Transcript

    1. Ruby On Rails… Siddhesh Bhobe
    2. What is Ruby?
      • An OO language!
      • … successfully combines Smalltalk's conceptual elegance, Python's ease of use and learning, and Perl's pragmatism…
      • … originated in Japan in the early 1990s
    3. What is Rails?
      • Rails is an open source Ruby framework for developing database-backed web applications
      • Rail's guiding principles:
        • less software and
        • convention over configuration
    4. Why the hell do we need another language and another framework???
    5. Well… What if you could develop a web application at least ten times faster with Rails?
    6. Let’s start with a demo…
    7. Demo Steps
      • Install Instant Rails which includes Rails, MySQL and an in-built web server – directory copy, no installation required
      • Create a Rails project
      • Create a database with sample table
      • Generate the model and controller in Rails
      • Provide CRUD functionality for the table on the web
      • IN TEN MINUTES
      • Check http://instantrails.rubyforge.org/tutorial/index.html to try this on your own!
    8. The Project Hierarchy – Convention over Configuration
    9. Main Modules of a Rails Application
      • The controllers subdirectory is where Rails looks to find controller classes. A controller handles a web request from the user.
      • The views subdirectory holds the display templates to fill in with data from our application, convert to HTML, and return to the user's browser.
      • The models subdirectory holds the classes that model and wrap the data stored in our application's database.
      • The helpers subdirectory holds any helper classes used to assist the model, view, and controller classes.
    10. Notes
      • The “scaffold” provides basic CRUD functionality, as well as basic views for the data – this can be overridden by you
      • URLs are simple and straightforward
      • Smartly maps models to table names - Recipe to recipes, Person to people and Country to countries 
    11. Overriding Scaffold Methods
      • Define your method (say, for the list functionality) in the controller
    12. Overriding Scaffold Methods
      • Provide your own list.rhtml - simply an html file with Ruby code embedded within <% %> and <%= %> tags
    13. And We Get..
    14. Setting Relationships between Model Objects
      • Class Recipe < ActiveRecord::Base
      • belongs_to :category
      • End
      • Class Category < ActiveRecord::Base
      • has_many :recipes
      • end
    15. Use Layouts
      • Provides common header/footer for all pages
      • Actual content goes in place of @content_for_layout
    16. And We Get…
    17. Hey, but this was too simple an application! Does it do anything serious?
    18. Some Real Applications
      • Basecamp is a web-based tool that lets you manage projects (or simply ideas) and quickly create client/project extranets. It lets you and your clients (or just your own internal team) keep your conversations, ideas, schedules, to-do lists, and more in a password-protected central location.
      • http://www.basecamphq.com/
    19. Some Real Applications
      • 43 Things is a goal-setting social software web application. It currently has 6,000 registered users and hundreds of thousands of unregistered visitors. 43 Things has 4,500 lines of code that were developed in three months by three full-time developers.
      • http://www.43things.com/
    20. Some Real Applications
      • Ta- da Lists is a free online service that implements simple, sharable to-do lists. It features a highly responsive user interface that uses XMLHttpRequest to minimize waiting for the server. Ta-da Lists came from one developer using one week of development time producing 579 lines of code.
      • http://www.tadalist.com/
    21. And More..
      • Check out the screencasts at
      • http://www.rubyonrails.org/screencasts
    22. Cool Rails Features
      • Caching
        • Page (as HTML), Action (Similar to Page, but applies filters like authentication), Fragment
        • Caches calculations, renderings and database calls
        • Sweeper – cleans the cache based on changes to the model objects
      • Data Validation
      • validates_length_of :category, :within => 1..20
      • Callbacks (like before and after triggers) – very useful for cache sweeping, for example
      • Transactions – save and destroy are already covered
      • Custom Code Generators
    23. Ajax on Rails
      • Ajax (Asynchronous JavaScript and XML) works on top of XMLHttpRequest
      • Ajax (through XMLHttpRequest) lets browser-side JavaScript communicate with the web server in the background without requiring the browser to display a new web page
      • Libraries like DWR and Ajax.NET provide high-level services for Ajax that hide browser-specific differences
      • Rails has built-in support for Ajax
    24. How it Works in Rails
      • A trigger action occurs. This could be the user clicking on a button or link, the user making changes to the data on a form or in a field, or just a periodic trigger.
      • Data associated with the trigger (a field or an entire form) is sent asynchronously to an action handler on the server via XMLHttpRequest.
      • The server-side action handler takes some action based on the data, and returns an HTML fragment as its response.
      • The client-side JavaScript (created automatically by Rails) receives the HTML fragment and uses it to update a specified part of the current page's HTML, often the content of a <div> tag.
    25. A Sample View File
    26. The Corresponding Controller
    27. And You Get…
    28. References
      • Article on which this presentation is based: http://instantrails.rubyforge.org/tutorial/index.html
      • Ruby Homepage:
      • http://www.ruby-lang.org/en/
      • Ruby on Rails Homepage:
      • http://www.rubyonrails.com/
      • Four Days on Rails (great to start with):
      • http://rails.homelinux.org/
      • Ruby on Rails How Tos:
      • http://wiki.rubyonrails.com/rails/pages/Howtos

    + Siddhesh BhobeSiddhesh Bhobe, 9 months ago

    custom

    286 views, 0 favs, 1 embeds more stats

    Introduction to Ruby on Rails

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 286
      • 278 on SlideShare
      • 8 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 7
    Most viewed embeds
    • 8 views on http://siddhesh-musings.blogspot.com

    more

    All embeds
    • 8 views on http://siddhesh-musings.blogspot.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags