The Rails 4 Way (Addison-wesley Professional Ruby) (3TH)

The Rails 4 Way (Addison-wesley Professional Ruby) (3TH)

  • ただいまウェブストアではご注文を受け付けておりません。 ⇒古書を探す
  • 製本 Paperback:紙装版/ペーパーバック版/ページ数 814 p.
  • 言語 ENG
  • 商品コード 9780321944276
  • DDC分類 005.117

Full Description


The "Bible" for Rails Development"When I read The Rails Way for the first time, I felt like I truly understood Rails for the first time."-From the Foreword by Steve KlabnikRuby on Rails 4 is leaner, tighter, and even more valuable to professional web developers. More than ever, it helps you focus on what matters most: delivering business value via clean and maintainable code. The Rails (TM) 4 Way is the only comprehensive, authoritative guide to delivering production-quality code with Rails 4. Kevin Faustino joins pioneering Rails developer Obie Fernandez to illuminate the entire Rails 4 API, including its most powerful and modern idioms, design approaches, and libraries. They present extensive new and updated content on security, performance, caching, Haml, RSpec, Ajax, the Asset Pipeline, and more.Through detailed code examples, you'll dive deep into the Rails 4 code base, discover why Rails is designed as it is, and learn how to make it do exactly what you want. Proven in dozens of production systems, this book's techniques will maximize your productivity and help you build more successful solutions. You'll want to keep this guide by your computer-you'll refer to it constantly.This guide will help youBuild powerful, scalable REST-compliant APIs Program complex program flows using Action Controller Represent models, relationships, CRUD operations, searches, validation, callbacks, and more Smoothly evolve application database schema via Migrations Apply advanced Active Record techniques: single-table inheritance, polymorphic models, and more Create visual elements with Action View and partials Optimize performance and scalability with view caching Master the highly productive Haml HTML templating engine Make the most of Rails' approach to session management Secure your systems with Rails 4's improved authentication and authorization Resist SQL Injection, XSS, XSRF, and other attacks Extend Rails with popular gems and plugins, and learn to write your own Integrate email services with Action Mailer Use Ajax via Rails 4 support for unobtrusive JavaScript Improve responsiveness with background processing Leverage Asset Pipeline to simplify development, improve perceived performance, and reduce server burdens Accelerate implementation and promote maintainability with RSpec

Contents

Foreword by Steve Klabnik xxxixForeword to the Previous Edition by David Heinemeier Hansson xliForeword to the Previous Edition by Yehuda Katz xliiiIntroduction xlv Acknowledgments li About the Authors liiiChapter 1: Rails Environments and Configuration 11.1 Bundler 2 1.2 Startup and Application Settings 91.3 Development Mode 181.4 Test Mode 221.5 Production Mode 231.6 Configuring a Database 261.7 Configuring Application Secrets 271.8 Logging 291.9 Conclusion 35Chapter 2: Routing 372.1 The Two Purposes of Routing 38 2.2 The routes.rb File 392.3 Route Globbing 512.4 Named Routes 532.5 Scoping Routing Rules 572.6 Listing Routes 602.7 Conclusion 61Chapter 3: REST, Resources, and Rails 633.1 REST in a Rather Small Nutshell 63 3.2 Resources and Representations 643.3 REST in Rails 653.4 Routing and CRUD 663.5 The Standard RESTful Controller Actions 693.6 Singular Resource Routes 733.7 Nested Resources 743.8 Routing Concerns 783.9 RESTful Route Customizations 793.10 Controller-Only Resources 833.11 Different Representations of Resources 863.12 The RESTful Rails Action Set 883.13 Conclusion 92Chapter 4: Working with Controllers 954.1 Rack 96 4.2 Action Dispatch: Where It All Begins 994.3 Render unto View... 1024.4 Additional Layout Options 1114.5 Redirecting 1114.6 Controller/View Communication 1154.7 Action Callbacks 1164.8 Streaming 1214.9 Variants 1264.10 Conclusion 127Chapter 5: Working with Active Record 1295.1 The Basics 130 5.2 Macro-Style Methods 1315.3 Defining Attributes 1335.4 CRUD: Create, Read, Update, and Delete 1385.5 Database Locking 1515.6 Where Clauses 1555.7 Connections to Multiple Databases in Different Models 1655.8 Using the Database Connection Directly 1675.9 Other Configuration Options 1715.10 Conclusion 171Chapter 6: Active Record Migrations 1736.1 Creating Migrations 173 6.2 Data Migration 1876.3 schema.rb 1896.4 Database Seeding 1906.5 Database-Related Rake Tasks 1916.6 Conclusion 194Chapter 7: Active Record Associations 1957.1 The Association Hierarchy 195 7.2 One-to-Many Relationships 1967.3 The belongs_to Association 2057.4 The has_many Association 2147.5 Many-to-Many Relationships 2227.6 One-to-One Relationships 2337.7 Working with Unsaved Objects and Associations 2367.8 Association Extensions 2387.9 The CollectionProxy Class 2397.10 Conclusion 240Chapter 8: Validations 2418.1 Finding Errors 241 8.2 The Simple Declarative Validations 2428.3 Common Validation Options 2538.4 Conditional Validation 2558.5 Short-Form Validation 2568.6 Custom Validation Techniques 2588.7 Skipping Validations 2608.8 Working with the Errors Hash 2618.9 Testing Validations with Shoulda 2628.10 Conclusion 262Chapter 9: Advanced Active Record 2639.1 Scopes 263 9.2 Callbacks 2689.3 Calculation Methods 2789.4 Single-Table Inheritance (STI) 2809.5 Abstract Base Model Classes 2869.6 Polymorphic has_many Relationships 2879.7 Enums 2909.8 Foreign-Key Constraints 2929.9 Modules for Reusing Common Behavior 2929.10 Modifying Active Record Classes at Runtime 2979.11 Using Value Objects 2999.12 Nonpersisted Models 3029.13 PostgreSQL Enhancements 3049.14 Conclusion 311Chapter 10: Action View 31310.1 Layouts and Templates 314 10.2 Partials 32210.3 Conclusion 329Chapter 11: All about Helpers 33111.1 ActiveModelHelper 331 11.2 AssetTagHelper 33811.3 AtomFeedHelper 34611.4 CacheHelper 34811.5 CaptureHelper 34811.6 CsrfHelper 34911.7 DateHelper 34911.8 DebugHelper 35611.9 FormHelper 35711.10 FormOptionsHelper 37111.11 FormTagHelper 37911.12 JavaScriptHelper 38511.13 NumberHelper 38511.14 OutputSafetyHelper 39011.15 RecordTagHelper 39011.16 RenderingHelper 39111.17 SanitizeHelper 39111.18 TagHelper 39311.19 TextHelper 39511.20 TranslationHelper and the I18n API 39911.21 UrlHelper 41811.22 Writing Your Own View Helpers 42211.23 Wrapping and Generalizing Partials 42511.24 Conclusion 431Chapter 12: Haml 43312.1 Getting Started 434 12.2 The Basics 43412.3 Doctype 44012.4 Comments 44012.5 Evaluating Ruby Code 44112.6 Helpers 44312.7 Filters 44412.8 Haml and Content 44512.9 Configuration Options 44612.10 Conclusion 448Chapter 13: Session Management 44913.1 What to Store in the Session 450 13.2 Session Options 45113.3 Storage Mechanisms 45113.4 Cookies 45513.5 Conclusion 457Chapter 14: Authentication and Authorization 45914.1 Devise 459 14.2 has_secure_password 46614.3 Pundit 47014.4 Conclusion 476Chapter 15: Security 47715.1 Password Management 477 15.2 Log Masking 47915.3 SSL (Secure Sockets Layer) 48015.4 Model Mass-Assignment Attributes Protection 48115.5 SQL Injection 48315.6 Cross-Site Scripting (XSS) 48415.7 XSRF (Cross-Site Request Forgery) 48715.8 Session Fixation Attacks 49015.9 Keeping Secrets 49115.10 Conclusion 492Chapter 16: Action Mailer 49316.1 Setup 493 16.2 Mailer Models 49416.3 Receiving Emails 50016.4 Server Configuration 50216.5 Testing Email Content 50216.6 Previews 50316.7 Conclusion 504Chapter 17: Caching and Performance 50517.1 View Caching 505 17.2 Data Caching 52117.3 Control of Web Caching 52317.4 ETags 52417.5 Conclusion 526Chapter 18: Background Processing 52718.1 Delayed Job 528 18.2 Sidekiq 53118.3 Resque 53718.4 Rails Runner 54118.5 Conclusion 543Chapter 19: Ajax on Rails 54519.1 Unobtrusive JavaScript 547 19.2 Turbolinks 55119.3 Ajax and JSON 55319.4 Ajax and HTML 55519.5 Ajax and JavaScript 55719.6 Conclusion 558Chapter 20: Asset Pipeline 55920.1 Asset Pipeline 560 20.2 Wish List 56020.3 The Big Picture 56120.4 Organization: Where Does Everything Go? 56120.5 Manifest Files 56120.6 Custom Format Handlers 56720.7 Postprocessing 56820.8 Helpers 56920.9 Fingerprinting 57120.10 Serving the Files 57220.11 Rake Tasks 57320.12 Conclusion 574Chapter 21: RSpec 57521.1 Introduction 575 21.2 Basic Syntax and API 57821.3 Matchers 58721.4 Custom Expectation Matchers 58821.5 Shared Behaviors 59121.6 Shared Context 59221.7 RSpec's Mocks and Stubs 59221.8 Running Specs 59521.9 RSpec Rails Gem 59621.10 RSpec Tools 60921.11 Conclusion 610Chapter 22: XML 61122.1 The to_xml Method 611 22.2 The XML Builder 62022.3 Parsing XML 62222.4 Conclusion 624Appendix A: Active Model API Reference 625A.1 AttributeMethods 625 A.2 Callbacks 627A.3 Conversion 629A.4 Dirty 629A.5 Errors 631A.6 ForbiddenAttributesError 635A.7 Lint::Tests 635A.8 Model 635A.9 Name 636A.10 Naming 638A.11 SecurePassword 638A.12 Serialization 638A.13 Serializers::JSON 639A.14 Serializers::Xml 639A.15 Translation 640A.16 Validations 641A.17 Validator 648Appendix B: Active Support API Reference 651B.1 Array 651 B.2 ActiveSupport::BacktraceCleaner 657B.3 Benchmark 658B.4 ActiveSupport::Benchmarkable 658B.5 BigDecimal 659B.6 ActiveSupport::Cache::Store 660B.7 ActiveSupport::CachingKeyGenerator 665B.8 ActiveSupport::Callbacks 665B.9 Class 668B.10 ActiveSupport::Concern 671B.11 ActiveSupport::Concurrency 672B.12 ActiveSupport::Configurable 673B.13 Date 673B.14 DateTime 682B.15 ActiveSupport::Dependencies 687B.16 ActiveSupport::Deprecation 693B.17 ActiveSupport::DescendantsTracker 694B.18 ActiveSupport::Duration 695B.19 Enumerable 696B.20 ERB::Util 697B.21 FalseClass 698B.22 File 698B.23 Hash 699B.24 ActiveSupport::Gzip 704B.25 ActiveSupport::HashWithIndifferentAccess 705B.26 ActiveSupport::Inflector::Inflections 705B.27 Integer 711B.28 ActiveSupport::JSON 712B.29 Kernel 712B.30 ActiveSupport::KeyGenerator 714B.31 ActiveSupport::Logger 714B.32 ActiveSupport::MessageEncryptor 715B.33 ActiveSupport::MessageVerifier 715B.34 Module 716B.35 ActiveSupport::Multibyte::Chars 724B.36 NilClass 729B.37 ActiveSupport::Notifications 729B.38 Object 738B.39 ActiveSupport::OrderedHash 743B.40 ActiveSupport::OrderedOptions 743B.41 ActiveSupport::PerThreadRegistry 744B.42 ActiveSupport::ProxyObject 744B.43 ActiveSupport::Railtie 745B.44 Range 746B.45 Regexp 747B.46 ActiveSupport::Rescuable 748B.47 String 748B.48 ActiveSupport::StringInquirer 758B.49 Struct 758B.50 ActiveSupport::Subscriber 758B.51 Symbol 759B.52 ActiveSupport::TaggedLogging 759B.53 ActiveSupport::TestCase 759B.54 ActiveSupport::Testing::Assertions 761B.55 Thread 762B.56 Time 763B.57 ActiveSupport::TimeWithZone 773B.58 ActiveSupport::TimeZone 774B.59 TrueClass 778B.60 ActiveSupport::XmlMini 778Appendix C: Rails Essentials 781C.1 Environmental Concerns 781 C.2 Essential Gems 782C.3 Ruby Toolbox 789C.4 Screencasts 789Index 791

最近チェックした商品