Draft chapters of the Ruby on Rails Tutorial, 3rd Edition
news.railstutorial.org
news.railstutorial.org
Before this book I'd never done any real web programming. My background is in compilers and trading systems/machine learning( those two are essentially one in the same), all C++ desktop software.
The book got me up and running, better than any of the online rails tutorials, and there are a lot of rails tutorials online.
One thing I really appreciated was that it didn't just build an app, it actually took you through the steps of deploying on Heroku and using git.
A Lot of other books and tutorials seem to assume you want to build an app and run it as localhost for the rest of its life.
The other nice touch was the chapter that teaches a Rails flavoured Ruby. As someone who had used Ruby for scripting, but never for Rails, I thought this was a nice touch.
For myself and a few people I've mentored, Agile Web Development with Rails[0] has yielded much better results. If they follow that up with Eloquent Ruby[1] they will be golden and well ahead of their peers with similar experience.
This book single-handedly breeds the "I'm a Rails Programmer!" that write terribly awful Ruby code that we all know and hate.
I don't mean to discredit Michael's hard work. Writing and maintaining a book like this is a huge achievement that I'm probably not capable of. I also appreciate that his book is at least bringing people into the Rails ecosystem. I just can't recommend it over others.
0 - https://pragprog.com/book/rails4/agile-web-development-with-...
1 - http://www.amazon.com/Eloquent-Ruby-Addison-Wesley-Professio...
"100% default stack. The 3rd edition of the Ruby on Rails Tutorial uses the default Rails choices for all relevant technologies, thereby substantially reducing the configuration necessary to get started. The excellent but syntactically heavy RSpec testing framework has been replaced with the default Rails testing stack (MiniTest), making for a much gentler introduction to testing than in previous editions."
> If you still find this tutorial too difficult, you might try starting with "Learn Ruby on Rails" by Daniel Kehoe...
Thank you, Michael. It's generous to mention my book. I've said that we need a better introduction for beginners and I'm overjoyed to see the improvements in the 3rd Edition. In the last two years, so many more people want to learn Rails, often without any background in other web platforms (or even programming).
Is it possible to add "overflow: scroll" to the code sample blocks' CSS? I get a few characters flow down to the next line which is a bit ugly. A couple of examples:
http://draft.railstutorial.org/book/rails_flavored_ruby#code...
first code block here (with a wrapped "g"): http://draft.railstutorial.org/book/rails_flavored_ruby#sec-...
UPDATE: They actually look fine in Chrome, but not in Firefox! I'm digging into it now.
UPDATE 2: Looks like it's working now
Another comment says change deployed but they're still off in Chrome on Mac (even with a forced/shift reload): http://imgur.com/IIaUiav
If you've got time, it'd be nice to see the installation and configuration chapter make it in as an appendix, since new programmers are going to want to set up their development environment at some point - it's just better to have it at the end of the book, when they've hopefully already gotten hooked.
Please don't take the advice to downplay rspec. I think in chapter 8 you update the User model. It was so incredibly nice that, having been a week or so since I was able to work on the project, I was confident that the introduced changes did not break any functionality of the app. It is very easy to not see the benefit of testing when learning, only to curse your luck when you look at code later.
I have recently read a good article using your test suite as an example of how to improve tests. The author criticized the terse nature of your tests, with subject and nested describes. He felt that you write once and read often, so there is great benefit to making the tests verbose. It is, in effect, a contract that any User model must satisfy to be a valid user model. Going DRY and code golf on it only helps to frustrate the person looking to acclimate themselves to a project rather than saving a few minutes during test creation.
Again all the best and thanks for the wonderful tutorial and interesting distribution network.
I think you may be confusing RSpec with testing generally. The 3rd edition replaces RSpec with the default Rails testing framework (MiniTest), but it still develops a thorough test suite.
However, I still think there's space for a fully modular approach to learning Rails instead of covering so many topics at once. For example, users could first learn how to use Active Record to interact with data on its own, and only later learn the other steps to building an app. This would also make it easy to look up topics later or just jump into the parts you're interested in. It would also be cool if users were given tasks with pre-written tests (but without solutions) so they would need to figure out the solution on their own and immediately see if they got it right.
(I even thought of creating a small Rails tutorial on http://www.learneroo.com but I can't currently run Rails on it. I guess one could either use an online IDE like Cloud9 or setup a custom Docker environment.)
Thank you for creating this resource, I used your book to learn ruby on rails.
I think all of the changes you made make sense to a person new to rails and they solve problems/walls I hit while progressing through the book:
- setup/configuring rails. In my case I was using non standard hardware, a web IDE eliminates the issue
- default stack: while going through the book, I was also referring to the official rails documentation, which uses defaults like mini-test and not rspec. Juggling two testing frameworks as someone new to web development was overwhelming.
- test lite: same as above
- version specific features: removing another point of failure is good
- highlighting lines: not sure, but it's good to see innovation
However, after a cursory glance at the tutorial, I was surprised to see how embedded Cloud9 was in this new version and that seems to be the route Hartl has taken. I'm wondering if anyone has used Cloud9 and what impressions they have?
Great work! Looking forward to taking a deeper look into the tutorial.
* What's a web framework? * Why do I want one? * How do I set up useful version controi? * How do I build an app? * How do I test my app? * How do I deploy my app to the real world?
No other book I have ever seen answers so many questions so eloquently. Thanks mhartl, you are doing something great for new web developers everywhere.
1. When do you expect to complete the 3rd edition? Seeing as the book is being heavily reworked and knowing your attention to detail, I guess the answer is "when it's ready".
2. Will the Rails version be fixed at 4.1?
I expect to use Rails 4.1 unless 4.2 is out of beta in time to use for the screencasts. I've compartmentalized the version-specific material, though, so I'm cautiously optimistic that I can swap in new Rails versions (even in the screencasts) as they're released.
Previous versions had way too much emphasis on testing, something I'd say unfortunately even 70% of real working Rails developers don't do in real projects.
is there any particular reason you switched from GitHub to Bitbucket in your tutorial?
Yes, this is the subject of [Box 1.4](http://draft.railstutorial.org/book/beginning#aside-github_b...). The tl;dr is that Bitbucket is free for private repos, which for security purposes the new edition uses by default.