ebook img

Learn Ruby on Rails - Updatey PDF

250 Pages·2013·1.69 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Learn Ruby on Rails - Updatey

Learn Ruby on Rails A tutorial by Daniel Kehoe · 1.c16 (prerelease) · 18 November 2013 learn-rails.com 1 Contents 1. About the Book ........................................... 3 2. Introduction ................................................. 4 3. Concepts........................................................ 9 4. Get Help When You Need It................. 15 5. Plan Your Product.................................... 19 6. Manage Your Project............................... 26 7. Accounts You May Need....................... 28 8. Get Started.................................................. 31 9. Create the Application............................ 39 10. The Parking Structure............................. 47 11. Time Travel with Git............................... 51 12. Gems ............................................................ 61 13. Configure.................................................... 71 14. Static Pages and Routing........................ 76 15. Request and Response ............................ 79 16. Dynamic Home Page .............................. 88 17. Troubleshoot.............................................. 98 18. Just Enough Ruby .................................. 110 19. Layout and Views .................................. 132 20. Front-End Framework .......................... 155 21. Add Pages................................................. 176 22. Contact Form........................................... 181 23. Spreadsheet Connection....................... 201 24. Send Mail.................................................. 207 25. Mailing List .............................................. 214 26. Deploy ....................................................... 223 27. Analytics ................................................... 235 28. Rails Challenges...................................... 242 29. Credits and Comments......................... 247 2 Chapter 1 About the Book I hope you will agree that this is the “best book for Rails beginners.” Over 900 people have downloaded an advance edition of this book. I’ve incorporated many of their suggestions for improvements. Over 600 people have contributed to the Kickstarter campaign to launch the book with pledges ranging from $9 to $350. Launching the book would not be possible without support from Kickstarter contributors. The Kickstarter campaign ends on Saturday, November 30th, at 5pm US Pacific Time. The Kickstarter campaign ends on Saturday, November 30th, at 5pm US Pacific Time. If you agree that the book is valuable, I hope you will contribute to the Kickstarter campaign. Click here: • Make a pledge to the Kickstarter campaign Make a pledge to the Kickstarter campaign In addition to contributing to the Kickstarter campaign, please help get the word out: • Write a blog post about the book • post the link on Twitter • post the link on Facebook • post the link on Google+ Mentioning the book online is important. Here’s the link to the book: • http://learn-rails.com/learn-ruby-on-rails.html http://learn-rails.com/learn-ruby-on-rails.html Thank you for your support. 3 Chapter 2 Introduction Welcome. This tutorial is a first step on your path to learn Ruby on Rails. You’ll learn key concepts so you’ll have a solid foundation for continued study. You’ll build a working web application so you’ll gain hands-on experience. Along the way, you’ll practice the techniques used by professional Rails developers and you’ll understand why Rails has become a popular choice for web development. 4 Is It for You? You don’t need to be a programmer to succeed with this tutorial. You’ll get comfortable with the Ruby programming language and the Unix command line interface as you build a Rails application. This tutorial is ideal if you are: • a student • a startup founder • making a career change Does this sound like you? Readers who work in social media or graphic design say this tutorial is a good way to get introduced to programming. Others who previously built simple websites using HTML, or used applications such as WordPress, found they could easily progress to building websites with Rails. Programmers with experience in languages such as PHP or Java found this tutorial to be a good way to get started with the Rails framework. On the other hand, if you’ve never encountered HTML, it is best to start elsewhere with an “Introduction to Web Design” course or online tutorial. Warnings This is two books in one. At the core is a hands-on tutorial that will lead you through the code needed to build a real-world web application. I thoroughly explain the code you’ll need to write a Rails application. Before you start coding, I explain the culture and practices of the Rails community. If you’re in a hurry to start coding, jump right now to Chapter 7, “Get Started.” But I urge you to read the preliminary chapters first. They’ll give you the context you need to become a skilled Rails developer. Many readers have told me the concepts at the beginning of the book provide a grounding they haven’t found in any other tutorial. The tutorial is designed to unfold in steps, one section leading to another. You can use the book as a reference, skipping around without reading from beginning to end, but you’ll actually waste time as you try to pick up the pieces you missed. The chapters are densely packed with links to background reading. If you click every link, you’ll be a well-informed student, but you may never finish the book! It’s up to you to master your curiosity. Follow the links only when you want to dive deeper. There is rich satisfaction in building something and making it run. But programming can be frustrating and Rails isn’t easy for beginners. Before you get to the reward, you’ll encounter setbacks. If at times you’re ready to quit, jump to the chapter titled “Rails Challenges”at the 5 end of the book. It describes many of the problems learners encounter. I’ve written it to address your concerns when learning Rails becomes difficult and frustrating. It’s best to work through the book from start to end, allowing enough time to read the introductory chapters and then building the application. That means you should allow time to read the book before you start a new job or join a developer bootcamp. Really! What To Expect You can read the book and complete the tutorial in one long weekend, though it will take concentration and stamina. If you work through the book over a longer timespan, try to work in uninterrupted blocks of two hours or more for reading and coding, as it takes time to focus and concentrate. When you’ve completed this tutorial, you will be ready for more advanced self-study, including other tutorials from the RailsApps project, textbook introductions to Rails, or workshops and developer bootcamps that provide intensive training in Ruby on Rails. Other curriculums often skip the basics. With this tutorial you’ll have a solid grounding in key concepts; you won’t feel overwhelmed or frustrated as you continue your studies. This tutorial is good preparation for: • advanced tutorials from the RailsApps Project • textbooks such as Michael Hartl’s Ruby on Rails Tutorial • introductory workshops from RailsBridge or Rails Girls • intensive training with immersive code camps We are blessed with many textbooks, workshops, and classroom programs that teach Ruby on Rails. I believe this book is unique in covering the basics while introducing the tools and techniques of professional Rails development. The RailsApps Project This book is the foundation for a series of tutorials that accompany example applications from the RailsApps project. Tutorials from @rails_apps take you on a guided path starting with absolute basics (this tutorial). You’ll progress to intermediate-level tutorials and soon be using the RailsApps in- depth guides for professional Rails developers. It is important to feel satisfaction and accomplishment as you learn. That’s why each tutorial introduces Rails in stages. With each tutorial you will build a real-world Rails application. The finished product confirms your accomplishment; you’ll feel genuine satisfaction as you 6 deploy your Rails application. Hands-on learning with real Rails applications is the key to absorbing and retaining knowledge. The applications you’ll build in the tutorials are not classroom exercises. The primary purpose of the RailsApps project is to provide starter applications for Rails developers. You’ll build real applications that you can customize and adapt for your startup, at your job, or for clients. Hundreds of developers use the RailsApps example applications, report problems as they arise, and propose solutions. Rails changes frequently; each application is known to work and serves as your personal “reference implementation” so you can stay up to date. Maintenance and development of the RailsApps applications is supported by subscriptions to the RailsApps tutorials. The Application We’ll build a basic web application that can be used by a typical small business. The website will include a home page, “about” page, contact form, and option to sign up for a mailing list. You’ll also learn how to collect data from a form and save it to a spreadsheet on Google Drive. You’ll find the complete learn-rails application on GitHub. It is a working application that is maintained by a team of experienced developers so you can always check the “reference implementation” if you have problems. A Note to Reviewers and Teachers This book approaches the subject differently than most introductions to Rails. It introduces concepts of product planning, project management, and website analytics to place development within a larger context of product development and marketing. In introducing Rails, rather than show the student how to use scaffolding, it introduces the model-view- controller design pattern by creating the components manually. The tutorial recommends test-driven development, but doesn’t show it, simply because I’ve found TDD can’t be adequately covered in a basic introduction. Lastly, though every other Rails tutorial shows how to use a database, this book doesn’t, because I want the book to be a short introduction and I believe the basic principles of a web application stand out more clearly without adding a database to the application. Though this tutorial is not a typical Rails introduction, I hope you’ll agree that it does a good job in preparing Rails beginners for continued study, whether it is developer bootcamp or more advanced books. Using the Book in the Classroom If you’ve organized a workshop, course, or code camp, and would like to assign the book as required reading, contact me at

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.