RAILS SOLUTIONS How to Use Ajax Techniques with Rails and When Not to Use Them How to Implement Other Web 2.0 Features in Rails, Such As Tag Clouds and Microformats

Total Page:16

File Type:pdf, Size:1020Kb

RAILS SOLUTIONS How to Use Ajax Techniques with Rails and When Not to Use Them How to Implement Other Web 2.0 Features in Rails, Such As Tag Clouds and Microformats CYAN YELLOW MAGENTA BLACK Williams In this book you’ll learn: How to develop web applications quickly and easily with the Ruby on Rails framework The basics of programming principles and Ruby syntax, so you can begin to understand what’s going on under the hood How to implement must-have web application features, such as user accounts, data validation, sending e-mail, image uploading, and more RAILS SOLUTIONS How to use Ajax techniques with Rails and when not to use them How to implement other Web 2.0 features in Rails, such as tag clouds and microformats If you’re a web designer or developer who thinks that and usability are kept in mind throughout, ensuring that the coding involved in developing dynamic web your site both looks and works great. applications is too difficult, think again. This book, and The book begins by covering how to set up your the framework it covers, is the perfect solution to your computer as a Rails development environment needs. Ruby on Rails provides an easy-to-use method (including the MySQL database) and then follows with for quickly developing web applications, simplifying an introduction to Ruby and the basics of the Rails potentially complicated subjects such as web framework. Next, you are taken through several architecture, JavaScript, and SQL/database creation. practical examples that work together to build up a The simplicity of Rails belies its power, though—this complete modern web application, covering essential technology is used by major companies such as and useful website features such as user login, adding 37Signals and Google. and editing data, data validation, image uploading, and Rails Solutions: Ruby on Rails Made Easy is an much more. The book even covers more-advanced Rails introduction to Ruby on Rails with the web designer in topics such as the Rails test suite, plug-ins and mind. Instead of focusing on the intricate syntax of each components, debugging techniques, and deploying your method, the book focuses on the tasks you’ll want to web applications using Capistrano. Create dynamic web applications as perform on your website and then walks you through painlessly as possible—no programming how to implement that functionality with Rails. Design knowledge required Enhance your user experience easily Also Available with Ajax techniques—Rails makes it easy for you Filled with practical techniques you can use right away SHELVING CATEGORY 1. WEB DEVELOPMENT ISBN-13: 978-1-59059-752-1 ISBN-10: 1-59059-752-4 53499 Mac/PC compatible US $34.99 www.friendsofed.com Justin Williams 9 781590 597521 this print for reference only—size & color not accurate spine = 0.675" 288 page count 7524fm.qxd 12/13/06 4:41 PM Page i Rails Solutions Ruby on Rails Made Easy Justin Williams 7524fm.qxd 12/13/06 4:41 PM Page ii Rails Solutions: Ruby on Rails Made Easy Copyright © 2007 by Justin Williams All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-59059-752-1 ISBN-10 (pbk): 1-59059-752-4 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit www.springeronline.com. For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit www.apress.com. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is freely available to readers at www.friendsofed.com in the Downloads section. Credits Lead Editor Copy Editor Chris Mills Nancy Sixsmith Technical Reviewers Assistant Production Director Ashish Bansal Kari Brooks-Copony Ryan J. Bonnell Production Editor Editorial Board Katie Stence Steve Anglin Ewan Buckingham Compositor Gary Cornell Molly Sharp Jason Gilmore Jonathan Gennick Jonathan Hassell Artist James Huddleston April Milne Chris Mills Matthew Moodie Proofreader Dominic Shakeshaft Linda Seifert Jim Sumser Keir Thomas Indexer Matt Wade Michael Brinkman Project Manager Interior and Cover Designer Beth Christmas Kurt Krames Copy Edit Manager Manufacturing Director Nicole Flores Tom Debolski 7524fm.qxd 12/13/06 4:41 PM Page iii CONTENTS AT A GLANCE Introduction . xv Chapter 1: Introduction to Ruby on Rails . 3 Chapter 2: Installing Rails . 17 Chapter 3: Ruby for Rails Developers . 39 Chapter 4: Getting Started with Rails . 53 Chapter 5: More Advanced Rails . 83 Chapter 6: Formatting Data . 107 Chapter 7: Introduction to Ajax . 117 Chapter 8: Bringing Forms to Life with Ajax . 127 Chapter 9: Uploading Files and Sending Attachments . 149 Chapter 10: User Authentication and Session Management . 161 Chapter 11: Customizing Rails Views . 183 7524fm.qxd 12/13/06 4:41 PM Page iv CONTENTS AT A GLANCE Chapter 12: Using Rails Plug-ins and Engines . 203 Chapter 13: Deploying with Capistrano . 223 Appendix A: Caching Your Content . 239 Appendix B: Testing Rails . 247 Index. 261 iv 7524fm.qxd 12/13/06 4:41 PM Page v CONTENTS Introduction . xv Chapter 1: Introduction to Ruby on Rails . 3 A history of Ruby . 5 Object-oriented programming . 6 Riding the Rails . 7 Components of Rails . 8 Model, View, Controller . 11 Rails’ database support . 12 Who uses Rails? . 12 Is Rails safe? . 14 Summary . 14 Chapter 2: Installing Rails . 17 Installing Rails on Mac OS X . 18 Installing Xcode . 19 Semiautomatic Rails install . 21 Manual install . 22 Setting the file path correctly . 22 Setting up Ruby on Mac OS X . 23 Installing the Rails framework on Mac OSX...finally! . 24 Installing FastCGI . 24 Installing Lighttpd . 25 Installing MySQL on Mac OSX . 26 Locomotive . 27 Extra tools for Mac OSX . 28 7524fm.qxd 12/13/06 4:41 PM Page vi CONTENTS Installing Rails on Windows . 28 Installing Ruby on Windows . 28 Installing MySQL on Windows . 30 InstantRails—Rails for Windows . 35 Extra tools for Windows . 35 Ready? Let’s do it! . 36 Chapter 3: Ruby for Rails Developers . 39 Basic Ruby syntax . 40 Ruby variables . 41 Classes and objects . 42 Inheritance . 46 Polymorphism . 47 Calling objects . 48 Arrays and hashes . 48 Decision structures . 49 while . 50 Iterators . 50 Exception handling . 51 Summary . 51 Chapter 4: Getting Started with Rails . 53 Creating a Rails project . 56 Configuring the web server . 57 Viewing the application . 58 Creating the database . 59 Windows . 60 Mac OS X . 60 Using the command line . 61 Telling Rails about the databases . 62 Creating the model . 63 Rails migrations . 64 Creating the controller . 67 Creating the views . ..
Recommended publications
  • Mysql Presentation
    MySQL Presentation Group members: Marco Tony Kassis Nourhan Sakr Roba Bairakdar Outline S What is MySQL? S History S Uses S Platforms and Interfaces S GUIs S Syntax S Why MySQL? What is MySQL? S It is the world’s most commonly used RDBMS S It is named after developer Michael Widenius; daughter, MY S Its source code is available under the terms of the GNU General Public License. S MySQL was owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, now owned by Oracle Corporation S MySQL is used in high-profile, large-scale World Wide Web products, including Wikipedia, Google, Facebook and Twitter. History S Originally developed by Michael Widenius and David Axmark in 1994 S First release on 23rd of May 1995 S Windows version was released in 1998 S … S MySQL server 5.5 was released in December 2010 Uses S It is the most popular choice of database for use in web applications S It is a central component of the widely used LAMP open source web application software stack (LAMP: Linux, Apache, MySQL, Perl/PHP/Python) Platforms and interfaces S MySQL is written in C and C++ S It works on many different system platforms, including Linux, Mac OS X, Solaris, etc. S Some programming languages include libraries for accessing MySQL databases. These include MySQL Connector/Net for integration with Microsoft’s Visual Studio and JDBC driver for Java Graphical User Interface S MySQL has no GUI tools to administer the databases or manage the data contained S Official MySQL Workbench enables users to graphically administer MySQL databases
    [Show full text]
  • Mr. Marten Mickos, CEO, Mysql AB
    Monetary and Social Economics of Information Sharing Fujitsu Labs of America Technology Symposium 2007 Mårten Mickos, CEO, MySQL AB Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 1 "The future is here, it's just not widely distributed yet." William Gibson Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 2 The World is Going Online 1 billion internet users - nearly 3 billion mobile phone users Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 3 Disruptive Innovations SOFTWARE BUSINESS DEVELOPMENT MODEL MODEL ONLINE ROLE OF ORGANISATIONAL SOFTWARE MODEL Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 4 The Internet Keeps Growing Netcraft: Total Sites Across All Domains August 1995 - October 2007 Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 5 From Web to Enterprise 66% Are Deploying MySQL or Are Planning To Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 6 Online, People ... Communicate ... Connect ... Share ... Play ... Trade ... craigslist Search & Look Up Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 7 An Architecture of Participation Time Magazine 2006 Person of the Year: You Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 8 Why Software Freedom is so Powerful Number of developers who built our current information Number of developers on the society internet today. 100X Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 9 Production by Amateurs "The highest and best form of efficiency is the spontaneous cooperation of a free people." Bernard Baruch, Financier and Roosevelt advisor, 1870-1965 Alla of the above run on MySQL.
    [Show full text]
  • Guide to Secure Software Development in Ruby
    Fedora Security Team Secure Ruby Development Guide Guide to secure software development in Ruby Ján Rusnačko Secure Ruby Development Guide Fedora Security Team Secure Ruby Development Guide Guide to secure software development in Ruby Edition 1 Author Ján Rusnačko [email protected] Copyright © 2014 Ján Rusnačko. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. The original authors of this document, and Red Hat, designate the Fedora Project as the "Attribution Party" for purposes of CC-BY-SA. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. For guidelines on the permitted uses of the Fedora trademarks, refer to https://fedoraproject.org/wiki/ Legal:Trademark_guidelines. Linux® is the registered trademark of Linus Torvalds in the United States and other countries. Java® is a registered trademark of Oracle and/or its affiliates. XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
    [Show full text]
  • Mysql Users Conference 2005, Keynote Speeches
    MySQL Users Conference April 18-21, 2005, Santa Clara, California Michael Tiemann Defining Open Source Open source is an indispensable element of the software industry but how did it get that way? Was it due to the success of pioneers such as Stallman and Torvalds? Was it the innovative licensing models, the collaborative community or was it just market economics at work? Michael Tiemann, founder of RedHat, President of the Open Source Initiative, Coder and long term open source advocate explores the many dimensions of the open source movement and poses some interesting questions to its community. Michael Teimann The characteristics of the open source movement and its community are not exclusive to the software industry. It runs far deeper than a single industry and drives to the core of human nature. Michael Tiemann shows how various innovations throughout history have only been possible through the architecture of participation. In the software industry distributed problem solving and code sharing has been instrumental to the success of Linux, MySQL, Apache and JBoss. The open source movement has redistributed the power structure in the operating system, database, web server and application server markets. Like Robin Hood and his Merry Men, it has taken from the few and given to the many. Keynote address Date: Tuesday, April 19 Time: 9:15am - 10:00am The Open Source Definition has changed the landscape of commercial software development--for the better. How might this new commercial interest change our notion of what makes for a "better" open source license? Some thoughts from a commercial /and/ OSI perspective.
    [Show full text]
  • Ruby on Rails™ Tutorial: Learn Web Developments with Rails
    ptg8286261 www.it-ebooks.info Praise for Michael Hartl’s Books and Videos on Ruby on RailsTM ‘‘My former company (CD Baby) was one of the first to loudly switch to Ruby on ptg8286261 Rails, and then even more loudly switch back to PHP (Google me to read about the drama). This book by Michael Hartl came so highly recommended that I had to try it, and the Ruby on RailsTM Tutorial is what I used to switch back to Rails again.’’ —From the Foreword by Derek Sivers (sivers.org) Formerly: Founder, CD Baby Currently: Founder, Thoughts Ltd. ‘‘Michael Hartl’s Rails Tutorial book is the #1 (and only, in my opinion) place to start when it comes to books about learning Rails. It’s an amazing piece of work and, unusually, walks you through building a Rails app from start to finish with testing. If you want to read just one book and feel like a Rails master by the end of it, pick the Ruby on RailsTM Tutorial.’’ —Peter Cooper Editor, Ruby Inside www.it-ebooks.info ‘‘Grounded in the real world.’’ —I Programmer (www.i-programmer.info), by Ian Elliot ‘‘The book gives you the theory and practice, while the videos focus on showing you in person how its done. Highly recommended combo.’’ —Antonio Cangiano, Software Engineer, IBM ‘‘The author is clearly an expert at the Ruby language and the Rails framework, but more than that, he is a working software engineer who introduces best practices throughout the text.’’ —Greg Charles, Senior Software Developer, Fairway Technologies ‘‘Overall, these video tutorials should be a great resource for anyone new to Rails.’’ —Michael Morin, ruby.about.com ‘‘Hands-down, I would recommend this book to anyone wanting to get into Ruby on Rails development.’’ —Michael Crump, Microsoft MVP ptg8286261 www.it-ebooks.info RUBY ON RAILSTM TUTORIAL Second Edition ptg8286261 www.it-ebooks.info Visit informit.com/ruby for a complete list of available products.
    [Show full text]
  • Cashpoint Saves Half a Million Euros Per Year As It Bets on Mysql
    MySQL in Online Entertainment Cashpoint Saves Half a Million Euros per Year as it Bets on MySQL About Cashpoint Cashpoint is a betting and gaming enterprise founded in 1996 in Austria and is the market leader in several EU countries including Germany and Austria. Cashpoint has an extensive network of betting offices, more than 3,000 betting terminals, and an online betting platform. Business Challenge The Sybase database that was originally deployed at Cashpoint no longer met their ever-increasing data management requirements. The stability, reliability, and performance did not allow Cashpoint to achieve the required level of ser- vice availability. Therefore Cashpoint searched for a stable and low administra- tion database environment to optimize their performanc levels, maintenance times, and availability demands. Online betting and gaming The MySQL Solution Today, Cashpoint utilizes both MySQL Enterprise Gold Unlimited subscrip- Hardware: Sun Fire X4170 & tion and the MySQL Cluster database for managing customer, web, and Dell PowerEdge results data with the required levels of high availability. The database OS: Red Hat cluster consists of four data and SQL nodes connected by the Dolphin Enterprise Linux Interconnect, in addition to two replication and standby nodes. Database: MySQL Enterprise Furthermore, the replication mechanisms of MySQL particularly met Server & MySQL Cashpoint's requirements for high availability and scalability. Cluster The cost/performance ratio of the overall solution was the decisive factor in switching to a MySQL-based solution. MySQL was able to comprehen- sively meet all the specifications. The usage of an enterprise-wide MySQL Enterprise subscription and of MySQL Cluster contributes to considerable “The expertise and short response cost savings.
    [Show full text]
  • James Reynolds What Is a Ruby on Rails Why Is It So Cool Major Rails Features Web Framework
    Ruby On Rails James Reynolds What is a Ruby on Rails Why is it so cool Major Rails features Web framework Code and tools for web development A webapp skeleton Developers plug in their unique code Platforms Windows Mac OS X Linux Installation Mac OS X 10.5 will include Rails Mac OS X 10.4 includes Ruby Most people reinstall it anyway From scratch Drag and drop Locomotive Databases Mysql Oracle SQLite Firebird PostgreSQL SQL Server DB2 more Webservers Apache w/ FastCGI or Mongrel LightTPD WEBrick "IDE's" TextMate and Terminal (preferred) RadRails jEdit Komodo Arachno Ruby Has "inspired" Grails CakePHP Trails PHP on TRAX Sails MonoRail Catalyst TrimPath Junction Pylons WASP ColdFusion on Wheels And perhaps more... Why is it so cool? Using the right tool for the job y = x^2 vs y = x^0.5 Right tool Rails is the most well thought-out web development framework I've ever used. And that's in a decade of doing web applications for a living. I've built my own frameworks, helped develop the Servlet API, and have created more than a few web servers from scratch. Nobody has done it like this before. James Duncan Davidson, Creator of Tomcat and Ant y = x ^ 2 vs y = x ^ 0.5 Features Features Work Work Typical Rare y = x ^ 2 vs y = x ^ 0.5 Feature ceiling Features Features Work Work This is a no-brainer... Ruby on Rails is a breakthrough in lowering the barriers of entry to programming. Powerful web applications that formerly might have taken weeks or months to develop can be produced in a matter of days.
    [Show full text]
  • Red Hat Quay 2.9 Deploy Red Hat Quay - Basic
    Red Hat Quay 2.9 Deploy Red Hat Quay - Basic Deploy Red Hat Quay Last Updated: 2019-04-20 Red Hat Quay 2.9 Deploy Red Hat Quay - Basic Deploy Red Hat Quay Legal Notice Copyright © 2019 Red Hat, Inc. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/ . In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. Linux ® is the registered trademark of Linus Torvalds in the United States and other countries. Java ® is a registered trademark of Oracle and/or its affiliates. XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries. MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and other countries. Node.js ® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
    [Show full text]
  • The Ruby Programming Language... It's Really Fun and It Feels Good!
    The Ruby Programming Language... it's really fun and it feels good! Dr. John Pagonis Pragmaticomm Limited, Athens Ruby Meetup #9, March 31st 2012 twitter: @greekrubymeetup @johnpagonis 1 1 Menu Why I got into Ruby? In search of a better way to code Ruby in twenty minutes (or thereabouts:-)‏ Why we should all have a look at it? 2 2 Before we start… a word ! A reminder from Fred. P. Brooks ‘’ No Silver Bullet - essence and accidents of software engineering’’,1986 ! ! There is NO silver bullet! 3 3 My experience with Ruby (mostly First got involved in 'Skunkworks' while at Symbian :-)‏ Ported with Pragmaticomm the Ruby 1.9.0.0 and Ruby 1.9.1p1 VM and some extensions to Symbian OS v9.1 (for Nokia's Symbian Research dept.)‏ I've used it for mobile programming, text filtering, classification, Web apps, machine learning, database access and Genetic Algorithm related work 4 4 Lately in my life (does it look familiar to you?)‏ There is a a lot of stuff I need to automate There are a lot of stuff I want to develop There are a lot of platforms I need to be using I need to be more efficient when coding. I have realised that my time and memory is MUCH more expensive than my CPUs’ time and RAM. I haven’t been getting any younger I haven’t been getting much smarter :-)‏ I think faster than I code! I am running out of time…. 5 5 Consequently Life is too short, to not have fun… !! ! I have to cheat! !There must be a better way to program… there must be!! 6 6 There must be a better way to program… there must be!! ..to clarify that !There must be a much better
    [Show full text]
  • Mariadb Viable Mysql Replacement Scale12x.Pdf
    MariaDB: Viable MySQL replacement Colin Charles, Team MariaDB, SkySQL Ab [email protected] | [email protected] http://mariadb.org/ http://bytebot.net/blog/ | @bytebot on Twitter SCALE12x, Los Angeles, California, USA 22 February 2014 Sunday, 23 February 14 whoami • Work on MariaDB at SkySQL Ab • Merged with Monty Program Ab, makers of MariaDB • Formerly MySQL AB (exit: Sun Microsystems) • Past lives include Fedora Project (FESCO), OpenOffice.org • MHA experience • since November 2011 (MHA 0.52, 0.53) • NRE work to make it run in a Solaris 10 environment... with no Internet access! • Continued deployment advice + work for data centre use • Much thanks to SkySQL for the experience Sunday, 23 February 14 MySQL? Percona Server? MariaDB? Sunday, 23 February 14 Agenda • 4 years: major server releases (5.1, 5.2, 5.3, 5.5, 5.5+TokuDB, Galera Cluster) and 10.0 series • Delving into history of previous releases • MariaDB 10.0 • Client libraries, Galera Cluster • Roadmap Sunday, 23 February 14 What isn’t covered • MariaDB Enterprise • Galera Cluster + GUI + API • mariadb.com • SkySQL • trademarks... Sunday, 23 February 14 What is MariaDB? • Community developed branch of MySQL • Feature enhanced • Fully compatible & feature complete with MySQL Sunday, 23 February 14 Backed by MariaDB Foundation • Driver of the MariaDB project • Foundation not controlled by single entity/ person; has a Board • Ensure MariaDB is compatible with MySQL, maintain mariadb.org, keep community voice • Major sponsors: SkySQL, Parallels, Booking.com, Automattic, OpenQuery, Percona,
    [Show full text]
  • An Introduction to Ruby and Rails
    An Introduction to Ruby and Rails This paper was originally presented at the Southwest Fox conference in Gilbert, Arizona in October, 2010. http://www.swfox.net An Introduction to Ruby and Rails Rick Borup Information Technology Associates 701 Devonshire Dr, Suite 127 Champaign, IL 61820 Voice: (217) 359-0918 Fax: (217) 398-0413 Email: [email protected] Ruby is a powerful, object-oriented, open-source language with a clean and easily understandable syntax. Originally released to the public in 1995, wide-spread interest in the Ruby language really began to take off in 2003 with the release of the Ruby on Rails® framework. Also known as "RoR" or simply "Rails", Ruby on Rails is an open-source Web framework that makes it possible to quickly and easily create data-based Web applications. Together, the Ruby language and the Ruby on Rails framework can become an exciting and powerful addition to any developer's toolbox. This session introduces both the Ruby language and the Rails framework, focusing on their installation and use on a Windows® platform with a perspective geared toward experienced Visual FoxPro® developers. © 2010 Rick Borup Page 1 of 64 An Introduction to Ruby and Rails Table of Contents Introduction............................................................................................................................................................ 4 Installing Ruby and Rails on Windows......................................................................................................... 4 Installing Instant Rails
    [Show full text]
  • An Empirical Study of Static Typing in Ruby
    Work In Progress: an Empirical Study of Static Typing in Ruby Mark T. Daly Vibha Sazawal Jeffrey S. Foster University of Maryland, College Park fmdaly,vibha,[email protected] Abstract tural object types, and optional and variable type lists for In this paper, we present an empirical pilot study of four method signatures. Prior experience shows that DRuby finds skilled programmers as they develop programs in Ruby, a errors in a range of existing Ruby programs, when used by popular, dynamically typed, object-oriented scripting lan- DRuby’s authors [Furr et al. 2009b,a]. In our study, we aim guage. Our study compares programmer behavior under the to understand whether DRuby’s static type system actually standard Ruby interpreter versus using Diamondback Ruby helps typical Ruby programmers find and fix errors—if not, (DRuby), which adds static type inference to Ruby. The aim why not, and if so, how could we improve DRuby’s type of our study is to understand whether DRuby’s static typing system to better serve programmers’ needs? is beneficial to programmers. We found that DRuby’s warn- Based on qualitative analysis of participant experiences, ings rarely provided information about potential errors not we made three tentative findings. First, using an open coding already evident from Ruby’s own error messages or from technique [Strauss 1987] to classify DRuby error messages presumed prior knowledge. We hypothesize that program- produced during participant trials, we found that under 20% mers have ways of reasoning about types that compensate of DRuby’s error messages were informative. Second, in in- for the lack of static type information, possibly limiting terviews, participants reported that they did use types as part DRuby’s usefulness when used on small programs.
    [Show full text]