Gosu, 2D game development library Ruby on Rails Guides Ruby on Rails Guides Ruby on Rails Tutorial: Learn Rails by Example book and screencasts by Michael Hartl | Static Pages Michael Hartl Contents Foreword My former company (CD Baby) was one of the first to loudly switch to Ruby on 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 Rails Tutorial is what I used to switch back to Rails again. Though I’ve worked my way through many Rails books, this is the one that finally made me “get” it. The linear narrative is such a great format. Enjoy! Derek Sivers (sivers.org) Founder, CD Baby Acknowledgments The Ruby on Rails Tutorial owes a lot to my previous Rails book, RailsSpace, and hence to my coauthor Aurelius Prochazka. I’d like to acknowledge a long list of Rubyists who have taught and inspired me over the years: David Heinemeier Hansson, Yehuda Katz, Carl Lerche, Jeremy Kemper, Xavier Noria, Ryan Bates, Geoffrey Grosenbach, Peter Cooper, Matt Aimonetti, Gregg Pollack, Wayne E. About the author Copyright and license 3.1 Static pages
Learn Web Development with the Ruby on Rails Tutorial Michael Hartl Contents Foreword My former company (CD Baby) was one of the first to loudly switch to Ruby on Rails, and then even more loudly switch back to PHP (Google me to read about the drama). Though I’ve worked my way through many Rails books, this is the one that finally made me “get” it. The linear narrative is such a great format. Enjoy! Derek Sivers (sivers.org) Founder, CD Baby Acknowledgments The Ruby on Rails Tutorial owes a lot to my previous Rails book, RailsSpace, and hence to my coauthor Aurelius Prochazka. I’d like to acknowledge a long list of Rubyists who have taught and inspired me over the years: David Heinemeier Hansson, Yehuda Katz, Carl Lerche, Jeremy Kemper, Xavier Noria, Ryan Bates, Geoffrey Grosenbach, Peter Cooper, Matt Aimonetti, Gregg Pollack, Wayne E. About the author Michael Hartl is the author of the Ruby on Rails Tutorial, the leading introduction to web development with Ruby on Rails. Copyright and license Welcome to the Ruby on Rails Tutorial.
The Best Way to Learn Rails I come from a PHP background, but these days, I'm a full-time Rails developer. The difficulty for most people who make the switch lies in the learning curve that’s involved. Once you've become proficient in a language or framework, switching to a new one feels like an unnecessary (and time-consuming) challenge. However, learning Ruby and Rails is actually pretty easy! This article details a full lesson plan that will get you up and running in no time! You might think learning Ruby is the most important step, and this is probably the part where everyone stops learning and just sticks with their current framework. Work through the Try Ruby exercises. The most recommended tool for dipping into Ruby's syntax is the Try Ruby website. Once you’ve worked through these exercises a couple of times, you'll have a solid base. Run gem install rails to install Rails. If you want to learn Rails, you’ll of course need to install it on your machine. Next, you need to install Rails. Great!
Ruby on Rails 3 Testing with RSpec 2 | Jonathan Hui Install Rspec-rails sudo gem install rspec-rails RSpec is a behavior driven development (BDD) framework for low level testing in the Ruby language Create a new Rails application store Edit the Gemfile Include the Cucumber gems in a Rails 3 application group :test, :development do gem "rspec-rails", "~> 2.4" gem 'capybara' end Install the Gems Edit the DB connection information and put the valid DB configuration information Create the MySQL DB rake db:create rake db:migrate Bootstrap a Rails 3 application with RSpec rails generate rspec:install create .rspec create spec create spec/spec_helper.rb Generate a model rails generate model order name:string invoke active_record create db/migrate/20110510190917_create_orders.rb create app/models/order.rb invoke rspec create spec/models/order_spec.rb Create the DB table General Syntax for RSpec describe "something" do it "does something" do ... end end Edit the RSpec Test vi spec/models/order_spec.rb Edit the RSpec testing code Smoke test let(:count) { @total += 1 }
Best way to learn Ruby & Rails - @AstonJ's Blog That’s no typo, I really did mean Ruby and Rails – but before you run off (those looking to learn only Rails) read on… I started off wanting to learn just Rails too, but I quickly realised two things: Rails will only get you so far – to be anything close to a Rails ninja, you need to learn Ruby (Rails is Ruby underneath it all). While Rails goes out of its way to simplify a lot, once you begin to do more complex stuff you’re going to need to know Ruby – and because Ruby is so easy to pick up anyway it makes sense to learn it from the outset. It will not only save you time in the long run, but will also help you learn Rails as well, because you’ll have a better understanding of what’s going on.Even if you came for Rails, most likely you will stay for Ruby – like so many of us! The more you’re exposed to Ruby the more you’ll want to learn it. Ruby is an awesome all-purpose language with a multitude of uses (it’s not just for web apps!) Is there really a best way to learn Ruby & Rails?
Rails Routing from the Outside In 1 The Purpose of the Rails Router The Rails router recognizes URLs and dispatches them to a controller's action. It can also generate paths and URLs, avoiding the need to hardcode strings in your views. 1.1 Connecting URLs to Code When your Rails application receives an incoming request for: it asks the router to match it to a controller action. 1.2 Generating Paths and URLs from Code You can also generate paths and URLs. and your application contains this code in the controller: and this in the corresponding view: then the router will generate the path /patients/17. 2 Resource Routing: the Rails Default Resource routing allows you to quickly declare all of the common routes for a given resourceful controller. 2.1 Resources on the Web Browsers request pages from Rails by making a request for a URL using a specific HTTP method, such as GET, POST, PATCH, PUT and DELETE. it asks the router to map it to a controller action. 2.2 CRUD, Verbs, and Actions 2.3 Path and URL Helpers 2.5 Singular Resources