買這商品的人也買了...
-
$970Introduction to Algorithms, 2/e
-
$580$458 -
$450$356 -
$700$686 -
$1,176Computer Organization and Design: The Hardware/Software Interface, 3/e(IE) (美國版ISBN:1558606041)
-
$680$646 -
$880$695 -
$550$468 -
$650$514 -
$780$741 -
$780$663 -
$3,026$2,875 -
$650$507 -
$550$468 -
$580$493 -
$350$298 -
$880$695 -
$420$328 -
$4,030$3,829 -
$250$165 -
$990$891 -
$580$452 -
$600$480 -
$720$612 -
$650$553
相關主題
商品描述
Description
Rails Cookbook is packed with the solutions you need to be a proficient developer with Rails, the leading framework for building the new generation of Web 2.0 applications. Recipes range from the basics, like installing Rails and setting up your development environment, to the latest techniques, such as developing RESTful web services.
With applications that are code light, feature-full and built to scale quickly, Rails has revolutionized web development. The Rails Cookbook addresses scores of real-world challenges; each one includes a tested solution, plus a discussion of how and why it works, so that you can adapt the techniques to similar situations. Topics include:
- Modeling data with the ActiveRecord library
- Setting up views with ActionView and RHTML templates
- Building your application's logic into ActionController
- Testing and debugging your Rails application
- Building responsive web applications using JavaScript and Ajax
- Ensuring that your application is security and performs well
- Deploying your application with Mongrel and Apache
- Using Capistrano to automate deployment
- Using the many Rails plugins
- Working with graphics
Whether you're new to Rails or an experienced developer, you'll discover ways to test, debug and secure your applications, incorporate Ajax, use caching to improve performance, and put your application into production. Want to get ahead of the Web 2.0 curve? This valuable cookbook will save you hundreds of hours when developing applications with Rails.
Table of Contents
Foreword
Preface
1. Getting Started
Introduction
Joining the Rails Community
Finding Documentation
Installing MySQL
Installing PostgreSQL
Installing Rails
Fixing Ruby and Installing Rails on OS X 10.4 Tiger
Running Rails in OS X with Locomotive
Running Rails in Windows with Instant Rails
Updating Rails with RubyGems
Getting Your Rails Project into Subversion
2. Rails Development
Introduction
Creating a Rails Project
Jump-Starting Development with Scaffolding
Speeding Up Rails Development with Mongrel
Enhancing Windows Development with Cygwin
Understanding Pluralization Patterns in Rails
Developing Rails in OS X with TextMate
Cross-Platform Developing with RadRails
Installing and Running Edge Rails
Setting Up Passwordless Authentication with SSH
Generating RDoc for Your Rails Application
Creating Full-Featured CRUD Applications with Streamlined
3. Active Record
Introduction
Setting Up a Relational Database to Use with Rails
Programmatically Defining Database Schema
Developing Your Database with Migrations
Modeling a Database with Active Record
Inspecting Model Relationships from the Rails Console
Accessing Your Data via Active Record
Retrieving Records with find
Iterating Over an Active Record Result Set
Retrieving Data Efficiently with Eager Loading
Updating an Active Record Object
Enforcing Data Integrity with Active Record Validations
Executing Custom Queries with find_by_sql
Protecting Against Race Conditions with Transactions
Adding Sort Capabilities to a Model with acts_as_list
Performing a Task Whenever a Model Object Is Created
Modeling a Threaded Forum with acts_as_nested_set
Creating a Directory of Nested Topics with acts_as_tree
Avoiding Race Conditions with Optimistic Locking
Handling Tables with Legacy Naming Conventions
Automating Record Timestamping
Factoring Out Common Relationships with Polymorphic Associations
Mixing Join Models and Polymorphism for Flexible Data Modeling
4. Action Controller
Introduction
Accessing Form Data from a Controller
Changing an Application’s Default Page
Clarifying Your Code with Named Routes
Configuring Customized Routing Behavior
Displaying Alert Messages with Flash
Extending the Life of a Flash Message
Following Actions with Redirects
Generating URLs Dynamically
Inspecting Requests with Filters
Logging with Filters
Rendering Actions
Restricting Access to Controller Methods
Sending Files or Data Streams to the Browser
Storing Session Information in a Database
Tracking Information with Sessions
Using Filters for Authentication
5. Action View
Introduction
Simplifying Templates with View Helpers
Displaying Large Datasets with Pagination
Creating a Sticky Select List
Editing Many-to-Many Relationships with Multiselect Lists
Factoring Out Common Display Code with Layouts
Defining a Default Application Layout
Generating XML with Builder Templates
Generating RSS Feeds from Active Record Data
Reusing Page Elements with Partials
Processing Dynamically Created Input Fields
Customizing the Behavior of Standard Helpers
Creating a Web Form with Form Helpers
Formatting Dates, Times, and Currencies
Personalizing User Profiles with Gravatars
Avoiding Harmful Code in Views with Liquid Templates
Globalizing Your Rails Application
6. RESTful Development
Introduction
Creating Nested Resources
Supporting Alternative Data Formats by MIME Type
Modeling Relationships RESTfully with Join Models
Moving Beyond Simple CRUD with RESTful Resources
Consuming Complex Nested REST Resources
Developing Your Rails Applications RESTfully
7. Rails Application Testing
Introduction
Centralizing the Creation of Objects Common to Test Cases
Creating Fixtures for Many-to-Many Associations
Importing Test Data with CSV Fixtures
Including Dynamic Data in Fixtures with ERb
Initializing a Test Database
Interactively Testing Controllers from the Rails Console
Interpreting the Output of Test::Unit
Loading Test Data with YAML Fixtures
Monitoring Test Coverage with rake stats
Running Tests with Rake
Speeding Up Tests with Transactional Fixtures
Testing Across Controllers with Integration Tests
Testing Controllers with Functional Tests
Examining the Contents of Cookie
Testing Custom and Named Routes
Testing HTTP Requests with Response-Related Assertions
Testing a Model with Unit Tests
Unit Testing Model Validations
Verifying DOM Structure with Tag-Related Assertions
Writing Custom Assertions
Testing File Upload
Modifying the Default Behavior of a Class for Testing by Using Mocks
Improving Feedback by Running Tests Continuously
Analyzing Code Coverage with Rcov
8. JavaScript and Ajax
Introduction
Adding DOM Elements to a Page
Creating a Custom Report with Drag and Drop
Dynamically Adding Items to a Select List
Monitoring the Content Length of a Textarea
Updating Page Elements with RJS Templates
Inserting JavaScript into Templates
Letting a User Reorder a List
Autocompleting a Text Field
Searching for and Highlighting Text Dynamically
Enhancing the User Interface with Visual Effects
Implementing a Live Search
Editing Fields in Place
Creating an Ajax Progress Indicator
9. Action Mailer
Introduction
Configuring Rails to Send Email
Creating a Custom Mailer Class with the Mailer Generator
Formatting Email Messages Using Templates
Attaching Files to Email Messages
Sending Email from a Rails Application
Receiving Email with Action Mailer
10. Debugging Rails Applications
Introduction
Exploring Rails from the Console
Fixing Bugs at the Source with Ruby -cw
Debugging Your Application in Real Time with the breakpointer
Logging with the Built-in Rails Logger Class
Writing Debugging Information to a File
Emailing Application Exceptions
Outputting Environment Information in Views
Displaying Object Contents with Exceptions
Filtering Development Logs in Real Time
Debugging HTTP Communication with Firefox Extensions
Debugging Your JavaScript in Real Time with the JavaScript Shell
Debugging Your Code Interactively with ruby-debug
11. Security
Introduction
Hardening Your Systems with Strong Passwords
Protecting Queries from SQL Injection
Guarding Against Cross-Site Scripting Attacks
Restricting Access to Public Methods or Actions
Securing Your Server by Closing Unnecessary Ports
12. Performance
Introduction
Measuring Web Server Performance with Httperf
Benchmarking Portions of Your Application Code
Improving Performance by Caching Static Pages
Expiring Cached Pages
Mixing Static and Dynamic Content with Fragment Caching
Filtering Cached Pages with Action Caching
Speeding Up Data Access Times with memcached
Increasing Performance by Caching Post-Processed Content
13. Hosting and Deployment
Introduction
Hosting Rails Using Apache 1.3 and mod_fastcgi
Managing Multiple Mongrel Processes with mongrel_cluster
Hosting Rails with Apache 2.2, mod_proxy_balancer, and Mongrel
Deploying Rails with Pound in Front of Mongrel, Lighttpd, and Apache
Customizing Pound’s Logging with cronolog
Configuring Pound with SSL Support
Simple Load Balancing with Pen
Deploying Your Rails Project with Capistrano
Deploying Your Application to Multiple Environments with Capistrano
Deploying with Capistrano When You Can’t Access Subversion
Deploying with Capistrano and mongrel_cluster
Disabling Your Web Site During Maintenance
Writing Custom Capistrano Tasks
Cleaning Up Residual Session Records
14. Extending Rails with Plug-ins
Introduction
Finding Third-Party Plug-ins
Installing Plug-ins
Manipulating Record Versions with acts_as_versioned
Building Authentication with acts_as_authenticated
Simplifying Folksonomy with the acts_as_taggable
Extending Active Record with acts_as
Adding View Helpers to Rails as Plug-ins
Uploading Files with file_column
Uploading Files with acts_as_attachment
Disabling Records Instead of Deleting Them with acts_as_paranoid
Adding More Elaborate Authentication Using the Login Engine
15. Graphics
Introduction
Installing RMagick for Image Processing
Uploading Images to a Database
Serving Images Directly from a Database
Creating Resized Thumbnails with RMagick
Generating PDF Documents
Visually Displaying Data with Gruff
Creating Small, Informative Graphs with Sparklines
A. Migrating to Rails 1.2
Action Controller
Active Record
Action View
Index
商品描述(中文翻譯)
**描述**
《Rails 食譜》提供了成為熟練 Rails 開發者所需的解決方案,Rails 是構建新一代 Web 2.0 應用程序的主要框架。食譜涵蓋了從基本的安裝 Rails 和設置開發環境,到最新技術,如開發 RESTful 網絡服務等各種主題。
Rails 以輕量級的代碼、功能豐富且能快速擴展的應用程序,徹底改變了網頁開發。《Rails 食譜》針對眾多現實挑戰,每個挑戰都包含經過測試的解決方案,以及如何和為什麼這些解決方案有效的討論,讓您能夠將這些技術應用於類似情況。主題包括:
- 使用 ActiveRecord 庫建模數據
- 使用 ActionView 和 RHTML 模板設置視圖
- 將應用程序邏輯構建到 ActionController 中
- 測試和調試您的 Rails 應用程序
- 使用 JavaScript 和 Ajax 構建響應式網頁應用程序
- 確保您的應用程序安全且性能良好
- 使用 Mongrel 和 Apache 部署您的應用程序
- 使用 Capistrano 自動化部署
- 使用眾多 Rails 插件
- 與圖形進行交互
無論您是 Rails 新手還是經驗豐富的開發者,您都會發現測試、調試和保護您的應用程序的方法,整合 Ajax,使用緩存來提高性能,並將您的應用程序投入生產。想要在 Web 2.0 的浪潮中領先一步嗎?這本寶貴的食譜將為您在使用 Rails 開發應用程序時節省數百小時的時間。
**目錄**
前言
序言
1. 開始使用
- 介紹
- 加入 Rails 社區
- 尋找文檔
- 安裝 MySQL
- 安裝 PostgreSQL
- 安裝 Rails
- 在 OS X 10.4 Tiger 上修復 Ruby 並安裝 Rails
- 在 OS X 中使用 Locomotive 運行 Rails
- 在 Windows 中使用 Instant Rails 運行 Rails
- 使用 RubyGems 更新 Rails
- 將您的 Rails 項目放入 Subversion
2. Rails 開發
- 介紹
- 創建 Rails 項目
- 使用 Scaffolding 快速啟動開發
- 使用 Mongrel 加速 Rails 開發
- 使用 Cygwin 增強 Windows 開發
- 理解 Rails 中的複數化模式
- 在 OS X 中使用 TextMate 開發 Rails
- 使用 RadRails 進行跨平台開發
- 安裝和運行 Edge Rails
- 使用 SSH 設置無密碼身份驗證
- 為您的 Rails 應用程序生成 RDoc
- 使用 Streamlined 創建全功能 CRUD 應用程序
3. Active Record
- 介紹
- 設置關聯數據庫以供 Rails 使用
- 程式化定義數據庫架構
- 使用遷移開發數據庫
- 使用 Active Record 建模數據庫
- 從 Rails 控制台檢查模型關係
- 通過 Active Record 訪問數據
- 使用 find 檢索記錄
- 遍歷 Active Record 結果集
- 使用 Eager Loading 高效檢索數據
- 更新 Active Record 對象
- 使用 Active Record 驗證強制數據完整性
- 使用 find_by_sql 執行自定義查詢
- 使用事務防止競爭條件
- 使用 acts_as_list 為模型添加排序功能
- 在模型對象創建時執行任務
- 使用 acts_as_nested_set 建模線程論壇
- 使用 acts_as_tree 創建嵌套主題目錄
- 使用樂觀鎖定避免競爭條件
- 處理具有舊命名約定的表
- 自動化記錄時間戳
- 使用多態關聯提取公共關係
- 混合聯接模型和多態性以靈活建模數據
4. Action Controller
- 介紹
- 從控制器訪問表單數據
- 更改應用程序的默認頁面
- 使用命名路由澄清代碼
- 配置自定義路由行為
- 使用 Flash 顯示警報消息
- 延長 Flash 消息的生命
- 使用重定向跟隨操作
- 動態生成 URL
- 使用過濾器檢查請求
- 使用過濾器進行日誌記錄
- 渲染操作
- 限制對控制器方法的訪問
- 將文件或數據流發送到瀏覽器
- 在數據庫中存儲會話信息
- 使用會話跟蹤信息
- 使用過濾器進行身份驗證
5. Action View
- 介紹
- 使用視圖助手簡化模板
- 使用分頁顯示大型數據集
- 創建一個固定選擇列表
- 使用多選列表編輯多對多關係
- 使用佈局提取公共顯示代碼
- 定義默認應用程序佈局
- 使用 Builder 模板生成 XML
- 從 Active Record 數據生成 RSS 源
- 使用部分重用頁面元素
- 處理動態創建的輸入字段
- 自定義標準助手的行為
- 使用表單助手創建網頁表單
- 格式化日期、時間和貨幣
- 使用 Gravatars 個性化用戶檔案
- 使用 Liquid 模板避免視圖中的有害代碼
- 全球化您的 Rails 應用程序
6. RESTful 開發
- 介紹
- 創建嵌套資源
- 通過 MIME 類型支持替代數據格式
- 使用聯接模型以 RESTful 方式建模關係
- 超越簡單 CRUD 的 RESTful 資源
- 消費複雜的嵌套 REST 資源
- 以 RESTful 方式開發您的 Rails 應用程序
7. Rails 應用程序測試
- 介紹
- 集中創建測試用例中常見的對象
- 為多對多關聯創建 Fixtures
- 使用 CSV Fixtures 導入測試數據
- 使用 ERb 在 Fixtures 中包含動態數據
- 初始化測試數據庫
- 從 Rails 控制台互動測試控制器
- 解釋 Test::Unit 的輸出
- 使用 YAML Fixtures 加載測試數據
- 使用 rake stats 監控測試覆蓋率
- 使用 Rake 運行測試
- 使用事務性 Fixtures 加速測試
- 使用集成測試跨控制器測試
- 使用功能測試測試控制器
- 檢查 Cookie 的內容
- 測試自定義和命名路由
- 使用與響應相關的斷言測試 HTTP 請求
- 使用單元測試測試模型
- 單元測試模型驗證
- 使用標籤相關的斷言驗證 DOM 結構
- 編寫自定義斷言
- 測試文件上傳
- 通過使用 Mocks 修改類的默認行為以進行測試
- 通過持續運行測試改善反饋
- 使用 Rcov 分析代碼覆蓋率
8. JavaScript 和 Ajax
- 介紹
- 向頁面添加 DOM 元素
- 使用拖放創建自定義報告
- 動態向選擇列表添加項目
- 監控文本區的內容長度
- 使用 RJS 模板更新頁面元素
- 在模板中插入 JavaScript
- 讓用戶重新排序列表
- 自動完成文本字段
- 動態搜索和突出顯示文本
- 使用視覺效果增強用戶界面
- 實現即時搜索
- 在原地編輯字段
- 創建 Ajax 進度指示器
9. Action Mailer
- 介紹
- 配置 Rails 發送電子郵件
- 使用 Mailer 生成器創建自定義郵件類
- 使用模板格式化電子郵件消息
- 將文件附加到電子郵件消息
- 從 Rails 應用程序發送電子郵件
- 使用 Action Mailer 接收電子郵件
10. 調試 Rails 應用程序
- 介紹
- 從控制台探索 Rails