Agile Web Development with Rails phần 1 pdf

55 443 0
Agile Web Development with Rails phần 1 pdf

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

greets fly out to koobe community :D [...]... me get started quickly 10 No XML! 1. 1 Rails Is Agile The title of this book is Agile Web Development with Rails You may be surprised, then, to discover that we don’t have explicit sections on applying agile practices X, Y, and Z to Rails coding The reason is both simple and subtle Agility is part of the fabric of Rails Let’s look at the values expressed in the Agile Manifesto .1 They’re stated as a set... starts a stand-alone web server that can run our newly created Rails application under WEBrick .1 So, without further ado, let’s start the application you just wrote demo> ruby script/server => Rails application started on http://0.0.0.0:3000 [2005-02-26 09 :16 :43] INFO WEBrick 1. 3 .1 [2005-02-26 09 :16 :43] INFO ruby 1. 8.2 (2004-08-24) [powerpc-darwin7.5.0] [2005-02-26 09 :16 :43] INFO WEBrick::HTTPServer-start:... just started a web server on port 3000.2 We can access the application by pointing a browser at http://localhost:3000 The result is shown in Figure 4 .1 1 WEBrick is a pure-Ruby web server that is distributed with Ruby 1. 8 .1 and later part of the address means that WEBrick will accept connections on all interfaces On Dave’s OS X system, that means both local interfaces (12 7.0.0 .1 and : :1) and his LAN... order to be timely, the APIs described in this book are those for Rails 1. 0 The code in the book has been tested against the 0 .13 release of Rails, the last release before Rails 1. 0 1. 3 Acknowledgments This book turned out to be a massive undertaking It would never have happened without an enormous amount of help from the Ruby and the Rails communities It’s hard to list everyone who contributed, so... page 18 0) 1 We cover the format of Rails URLs later in the book However, it’s worth pointing out here that having URLs perform actions such as add to cart can be dangerous See Section 16 .9, The Problem with GET Requests, on page 324, for more details Report erratum 11 M ODELS , V IEWS , Routing C ONTROLLERS http://my.url/store/add_to_cart /12 3 Routing finds Store controller Controller interacts with. .. small package, and you’ll get RubyGems as well I NSTALLING ON M AC OS X 3 Now we’ll use RubyGems to install Rails and a few things that Rails needs C:\> gem install rails include-dependencies Congratulations! You’re now on Rails 3.2 Installing on Mac OS X 1 OS X version 10 .4 (Tiger) ships with Ruby 1. 8.2 You can verify this by starting the terminal application (use the Finder to navigate to Applications... window dave> tar xzf rubygems-0.8 .10 .tar.gz dave> cd rubygems-0.8 .10 rubygems-0.8 .10 > sudo ruby setup.rb Password: 4 We’ll now use RubyGems to install Rails Still in the shell, issue the following command dave> sudo gem install rails include-dependencies And (one last time), congratulations! You’re now on Rails 3.4 Rails and Databases If your Rails application uses a database... right Of course you’ll have to take our word for that until you write some Rails applications for yourself (which should be in the next 45 minutes or so ) That’s what this book is all about Report erratum 2 R AILS I S A GILE Dave’s Top 10 Reasons To Like Rails 1 It brings agility to web development 2 I can create web pages with neat effects, just like the cool kids do 3 It lets me focus on creating... interactive process 1 http://agilemanifesto.org/ Dave Thomas was one of the 17 authors of this document Report erratum 3 F INDING Y OUR WAY A ROUND Rails doesn’t denounce documentation Rails makes it trivially easy to create HTML documentation for your entire codebase But the Rails development process isn’t driven by documents You won’t find 500-page specifications at the heart of a Rails project Instead,... database you use because you just want to experiment with Rails, our recommendation is that you try MySQL It’s easy to install, and Rails comes with a built-in driver (written in pure Ruby) for MySQL databases You can use it to connect a Rails application to MySQL with no extra work That’s one of the reasons that the examples in this book all use MySQL .1 If you do end up using MySQL, remember to check . Testing 13 2 12 .1 Tests Baked Right In 13 2 12 .2 Testing Models 13 3 12 .3 Testing Controllers 14 8 12 .4 Using Mock Objects 16 1 12 .5 Test-Driven Development 16 2 12 .6 Running Tests with Rake 16 5 12 .7. Performance Testing 16 8 Part III—The Rails Framework 17 2 13 Rails in Depth 17 3 13 .1 So Where’s Rails? 17 3 13 .2 Directory Structure 17 3 13 .3 Rails Configuration 17 7 13 .4 Naming Conventions 18 0 13 .5 Active. 18 4 13 .6 Logging in Rails 18 6 13 .7 Debugging Hints 18 6 13 .8 What’s Next 18 8 14 Active Record Basics 19 0 14 .1 Tables and Classes 19 1 14 .2 Columns and Attributes 19 2 14 .3 Primary Keys and IDs 19 7 14 .4

Ngày đăng: 07/08/2014, 00:22

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan