Changeset 2908
- Timestamp:
- 11/07/05 09:51:47 (3 years ago)
- Files:
-
- trunk/actionpack/README (modified) (5 diffs)
- trunk/activerecord/README (modified) (6 diffs)
- trunk/activesupport/README (modified) (1 diff)
- trunk/railties/README (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/README
r2649 r2908 25 25 Record. Action Pack is an independent package that can be used with any sort 26 26 of backend (Instiki[http://www.instiki.org], which is based on an older version 27 of Action Pack, use sMadeleine for example). Read more about the role Action27 of Action Pack, used Madeleine for example). Read more about the role Action 28 28 Pack can play when used together with Active Record on 29 29 http://www.rubyonrails.org. … … 32 32 33 33 * Actions grouped in controller as methods instead of separate command objects 34 and can therefore helper sharemethods.34 and can therefore share helper methods. 35 35 36 36 BlogController < ActionController::Base … … 104 104 # Before this action is run, the user will be authenticated, the cache 105 105 # will be examined to see if a valid copy of the results already 106 # exist , and the action will be logged for auditing.106 # exists, and the action will be logged for auditing. 107 107 108 108 # After this action has run, the output will first be localized then 109 # compressed to minimize bandwi th usage109 # compressed to minimize bandwidth usage 110 110 end 111 111 112 112 private 113 113 def authenticate 114 # Implement the filter wi llfull access to both request and response114 # Implement the filter with full access to both request and response 115 115 end 116 116 end … … 317 317 <%= form "post" %> 318 318 319 ...will generate something like (the selects will have more options of319 ...will generate something like (the selects will have more options, of 320 320 course): 321 321 … … 414 414 This simple setup will list all the posts in the system on the index page, 415 415 which is called by accessing /weblog/. It uses the form builder for the Active 416 Record model to make the new screen, which in turn s handeverything over to416 Record model to make the new screen, which in turn hands everything over to 417 417 the create action (that's the default target for the form builder when given a 418 418 new model). After creating the post, it'll redirect to the display page using trunk/activerecord/README
r2825 r2908 2 2 3 3 Active Record connects business objects and database tables to create a persistable 4 domain model where logic and data ispresented in one wrapping. It's an implementation4 domain model where logic and data are presented in one wrapping. It's an implementation 5 5 of the object-relational mapping (ORM) pattern[http://www.martinfowler.com/eaaCatalog/activeRecord.html] 6 6 by the same name as described by Martin Fowler: … … 9 9 the database access, and adds domain logic on that data." 10 10 11 Active Record s main contribution to the pattern is to relieve the original of two stunting problems:11 Active Record's main contribution to the pattern is to relieve the original of two stunting problems: 12 12 lack of associations and inheritance. By adding a simple domain language-like set of macros to describe 13 13 the former and integrating the Single Table Inheritance pattern for the latter, Active Record narrows the … … 158 158 pkId = 1234 159 159 cat = Cat.find(pkId) 160 # something even more interesting involving athe same cat...160 # something even more interesting involving the same cat... 161 161 cat.save 162 162 … … 190 190 Data definitions are specified only in the database. Active Record queries the database for 191 191 the column names (that then serves to determine which attributes are valid) on regular 192 object sinstantiation through the new constructor and relies on the column names in the rows192 object instantiation through the new constructor and relies on the column names in the rows 193 193 with the finders. 194 194 … … 236 236 == Simple example (2/2): Using the domain 237 237 238 Picking a database connection for all the active records238 Picking a database connection for all the Active Records 239 239 240 240 ActiveRecord::Base.establish_connection( … … 301 301 == Philosophy 302 302 303 Active Record attempts to provide a coherent wrapp ingfor the inconvenience that is303 Active Record attempts to provide a coherent wrapper as a solution for the inconvenience that is 304 304 object-relational mapping. The prime directive for this mapping has been to minimize 305 the amount of code needed to buil ta real-world domain model. This is made possible305 the amount of code needed to build a real-world domain model. This is made possible 306 306 by relying on a number of conventions that make it easy for Active Record to infer 307 307 complex relations and structures from a minimal amount of explicit direction. trunk/activesupport/README
r784 r2908 19 19 == Installation 20 20 21 The prefer ed method of installing Active Support is through its GEM file. You'll need to have22 RubyGems[http://rubygems.rubyforge.org/wiki/wiki.pl] installed for that, though. If you have ,21 The preferred method of installing Active Support is through its GEM file. You'll need to have 22 RubyGems[http://rubygems.rubyforge.org/wiki/wiki.pl] installed for that, though. If you have it, 23 23 then use: 24 24 trunk/railties/README
r2796 r2908 1 1 == Welcome to Rails 2 2 3 Rails is a web-application and persist ance framework that includes everything3 Rails is a web-application and persistence framework that includes everything 4 4 needed to create database-backed web-applications according to the 5 5 Model-View-Control pattern of separation. This pattern splits the view (also 6 6 called the presentation) into "dumb" templates that are primarily responsible 7 for inserting pre-buil ddata in between HTML tags. The model contains the7 for inserting pre-built data in between HTML tags. The model contains the 8 8 "smart" domain objects (such as Account, Product, Person, Post) that holds all 9 9 the business logic and knows how to persist themselves to a database. The … … 11 11 Product, Show Post) by manipulating the model and directing data to the view. 12 12 13 In Rails, the model is handled by what's called a object-relational mapping13 In Rails, the model is handled by what's called an object-relational mapping 14 14 layer entitled Active Record. This layer allows you to present the data from 15 15 database rows as objects and embellish these data objects with business logic … … 17 17 link:files/vendor/rails/activerecord/README.html. 18 18 19 The controller and view ishandled by the Action Pack, which handles both19 The controller and view are handled by the Action Pack, which handles both 20 20 layers by its two parts: Action View and Action Controller. These two layers 21 21 are bundled in a single package due to their heavy interdependence. This is … … 50 50 51 51 NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI 52 should be on and ".cgi" should respond. All requests from 127.0.0.1 go es52 should be on and ".cgi" should respond. All requests from 127.0.0.1 go 53 53 through CGI, so no Apache restart is necessary for changes. All other requests 54 go es through FCGI (or mod_ruby) that requiresrestart to show changes.54 go through FCGI (or mod_ruby), which requires a restart to show changes. 55 55 56 56 … … 102 102 Here you'll have all parts of the application configured, just like it is when the 103 103 application is running. You can inspect domain models, change values, and save to the 104 database. Start the script without arguments will launch it in the development environment.104 database. Starting the script without arguments will launch it in the development environment. 105 105 Passing an argument will specify a different environment, like <tt>console production</tt>. 106 106 … … 118 118 app/models 119 119 Holds models that should be named like post.rb. 120 Most models will descen tfrom ActiveRecord::Base.120 Most models will descend from ActiveRecord::Base. 121 121 122 122 app/views 123 123 Holds the template files for the view that should be named like 124 weblog/index.rhtml for the WeblogController#index action. All views use seRuby124 weblog/index.rhtml for the WeblogController#index action. All views use eRuby 125 125 syntax. This directory can also be used to keep stylesheets, images, and so on 126 126 that can be symlinked to public. … … 133 133 134 134 components 135 Self-contained mini-applications that can bundle controllers, models, and views together.135 Self-contained mini-applications that can bundle together controllers, models, and views. 136 136 137 137 lib 138 138 Application specific libraries. Basically, any kind of custom code that doesn't 139 belong controllers, models, or helpers. This directory is in the load path.139 belong under controllers, models, or helpers. This directory is in the load path. 140 140 141 141 public 142 The directory available for the web server. Contains sub -directories for images, stylesheets,142 The directory available for the web server. Contains subdirectories for images, stylesheets, 143 143 and javascripts. Also contains the dispatchers and the default HTML files. 144 144 … … 150 150 151 151 vendor 152 External libraries that the application depend on. This directory is in the load path. 152 External libraries that the application depends on. Also includes the plugins subdirectory. 153 This directory is in the load path.