rails 2.2.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails might be problematic. Click here for more details.
- data/bin/rails +8 -18
- metadata +118 -452
- data/CHANGELOG +0 -2071
- data/MIT-LICENSE +0 -20
- data/README +0 -256
- data/Rakefile +0 -411
- data/bin/about +0 -4
- data/bin/console +0 -3
- data/bin/dbconsole +0 -3
- data/bin/destroy +0 -3
- data/bin/generate +0 -3
- data/bin/performance/benchmarker +0 -3
- data/bin/performance/profiler +0 -3
- data/bin/performance/request +0 -3
- data/bin/plugin +0 -3
- data/bin/process/inspector +0 -3
- data/bin/process/reaper +0 -3
- data/bin/process/spawner +0 -3
- data/bin/runner +0 -3
- data/bin/server +0 -3
- data/builtin/rails_info/rails/info.rb +0 -125
- data/builtin/rails_info/rails/info_controller.rb +0 -9
- data/builtin/rails_info/rails/info_helper.rb +0 -2
- data/builtin/rails_info/rails_info_controller.rb +0 -2
- data/config.ru +0 -17
- data/configs/apache.conf +0 -40
- data/configs/databases/frontbase.yml +0 -28
- data/configs/databases/ibm_db.yml +0 -62
- data/configs/databases/mysql.yml +0 -57
- data/configs/databases/oracle.yml +0 -39
- data/configs/databases/postgresql.yml +0 -51
- data/configs/databases/sqlite2.yml +0 -19
- data/configs/databases/sqlite3.yml +0 -22
- data/configs/empty.log +0 -0
- data/configs/initializers/inflections.rb +0 -10
- data/configs/initializers/mime_types.rb +0 -5
- data/configs/initializers/new_rails_defaults.rb +0 -17
- data/configs/lighttpd.conf +0 -54
- data/configs/locales/en.yml +0 -5
- data/configs/routes.rb +0 -43
- data/dispatches/dispatch.fcgi +0 -24
- data/dispatches/dispatch.rb +0 -10
- data/dispatches/gateway.cgi +0 -97
- data/doc/README_FOR_APP +0 -5
- data/doc/guides/html/2_2_release_notes.html +0 -1185
- data/doc/guides/html/actioncontroller_basics.html +0 -1270
- data/doc/guides/html/activerecord_validations_callbacks.html +0 -749
- data/doc/guides/html/association_basics.html +0 -2585
- data/doc/guides/html/authors.html +0 -240
- data/doc/guides/html/benchmarking_and_profiling.html +0 -1018
- data/doc/guides/html/caching_with_rails.html +0 -583
- data/doc/guides/html/command_line.html +0 -434
- data/doc/guides/html/configuring.html +0 -438
- data/doc/guides/html/creating_plugins.html +0 -1594
- data/doc/guides/html/debugging_rails_applications.html +0 -1175
- data/doc/guides/html/finders.html +0 -1090
- data/doc/guides/html/form_helpers.html +0 -638
- data/doc/guides/html/getting_started_with_rails.html +0 -2066
- data/doc/guides/html/index.html +0 -349
- data/doc/guides/html/layouts_and_rendering.html +0 -1406
- data/doc/guides/html/migrations.html +0 -921
- data/doc/guides/html/routing_outside_in.html +0 -2213
- data/doc/guides/html/security.html +0 -1346
- data/doc/guides/html/testing_rails_applications.html +0 -1859
- data/doc/guides/source/2_2_release_notes.txt +0 -435
- data/doc/guides/source/actioncontroller_basics/changelog.txt +0 -5
- data/doc/guides/source/actioncontroller_basics/cookies.txt +0 -34
- data/doc/guides/source/actioncontroller_basics/csrf.txt +0 -32
- data/doc/guides/source/actioncontroller_basics/filters.txt +0 -119
- data/doc/guides/source/actioncontroller_basics/http_auth.txt +0 -24
- data/doc/guides/source/actioncontroller_basics/index.txt +0 -40
- data/doc/guides/source/actioncontroller_basics/introduction.txt +0 -9
- data/doc/guides/source/actioncontroller_basics/methods.txt +0 -39
- data/doc/guides/source/actioncontroller_basics/parameter_filtering.txt +0 -14
- data/doc/guides/source/actioncontroller_basics/params.txt +0 -93
- data/doc/guides/source/actioncontroller_basics/request_response_objects.txt +0 -43
- data/doc/guides/source/actioncontroller_basics/rescue.txt +0 -67
- data/doc/guides/source/actioncontroller_basics/session.txt +0 -187
- data/doc/guides/source/actioncontroller_basics/streaming.txt +0 -91
- data/doc/guides/source/actioncontroller_basics/verification.txt +0 -40
- data/doc/guides/source/active_record_basics.txt +0 -181
- data/doc/guides/source/activerecord_validations_callbacks.txt +0 -404
- data/doc/guides/source/association_basics.txt +0 -1840
- data/doc/guides/source/authors.txt +0 -39
- data/doc/guides/source/benchmarking_and_profiling/appendix.txt +0 -95
- data/doc/guides/source/benchmarking_and_profiling/digging_deeper.txt +0 -105
- data/doc/guides/source/benchmarking_and_profiling/edge_rails_features.txt +0 -185
- data/doc/guides/source/benchmarking_and_profiling/gameplan.txt +0 -27
- data/doc/guides/source/benchmarking_and_profiling/index.txt +0 -242
- data/doc/guides/source/benchmarking_and_profiling/rubyprof.txt +0 -179
- data/doc/guides/source/benchmarking_and_profiling/statistics.txt +0 -57
- data/doc/guides/source/caching_with_rails.txt +0 -367
- data/doc/guides/source/command_line.txt +0 -147
- data/doc/guides/source/configuring.txt +0 -225
- data/doc/guides/source/creating_plugins/acts_as_yaffle.txt +0 -191
- data/doc/guides/source/creating_plugins/appendix.txt +0 -46
- data/doc/guides/source/creating_plugins/controllers.txt +0 -59
- data/doc/guides/source/creating_plugins/core_ext.txt +0 -123
- data/doc/guides/source/creating_plugins/custom_route.txt +0 -69
- data/doc/guides/source/creating_plugins/gem.txt +0 -1
- data/doc/guides/source/creating_plugins/generator_method.txt +0 -89
- data/doc/guides/source/creating_plugins/helpers.txt +0 -51
- data/doc/guides/source/creating_plugins/index.txt +0 -52
- data/doc/guides/source/creating_plugins/migration_generator.txt +0 -156
- data/doc/guides/source/creating_plugins/models.txt +0 -76
- data/doc/guides/source/creating_plugins/odds_and_ends.txt +0 -69
- data/doc/guides/source/creating_plugins/test_setup.txt +0 -230
- data/doc/guides/source/debugging_rails_applications.txt +0 -733
- data/doc/guides/source/finders.txt +0 -668
- data/doc/guides/source/form_helpers.txt +0 -345
- data/doc/guides/source/getting_started_with_rails.txt +0 -1256
- data/doc/guides/source/images/belongs_to.png +0 -0
- data/doc/guides/source/images/bullet.gif +0 -0
- data/doc/guides/source/images/csrf.png +0 -0
- data/doc/guides/source/images/habtm.png +0 -0
- data/doc/guides/source/images/has_many.png +0 -0
- data/doc/guides/source/images/has_many_through.png +0 -0
- data/doc/guides/source/images/has_one.png +0 -0
- data/doc/guides/source/images/has_one_through.png +0 -0
- data/doc/guides/source/images/header_backdrop.png +0 -0
- data/doc/guides/source/images/icons/README +0 -5
- data/doc/guides/source/images/icons/callouts/1.png +0 -0
- data/doc/guides/source/images/icons/callouts/10.png +0 -0
- data/doc/guides/source/images/icons/callouts/11.png +0 -0
- data/doc/guides/source/images/icons/callouts/12.png +0 -0
- data/doc/guides/source/images/icons/callouts/13.png +0 -0
- data/doc/guides/source/images/icons/callouts/14.png +0 -0
- data/doc/guides/source/images/icons/callouts/15.png +0 -0
- data/doc/guides/source/images/icons/callouts/2.png +0 -0
- data/doc/guides/source/images/icons/callouts/3.png +0 -0
- data/doc/guides/source/images/icons/callouts/4.png +0 -0
- data/doc/guides/source/images/icons/callouts/5.png +0 -0
- data/doc/guides/source/images/icons/callouts/6.png +0 -0
- data/doc/guides/source/images/icons/callouts/7.png +0 -0
- data/doc/guides/source/images/icons/callouts/8.png +0 -0
- data/doc/guides/source/images/icons/callouts/9.png +0 -0
- data/doc/guides/source/images/icons/caution.png +0 -0
- data/doc/guides/source/images/icons/example.png +0 -0
- data/doc/guides/source/images/icons/home.png +0 -0
- data/doc/guides/source/images/icons/important.png +0 -0
- data/doc/guides/source/images/icons/next.png +0 -0
- data/doc/guides/source/images/icons/note.png +0 -0
- data/doc/guides/source/images/icons/prev.png +0 -0
- data/doc/guides/source/images/icons/tip.png +0 -0
- data/doc/guides/source/images/icons/up.png +0 -0
- data/doc/guides/source/images/icons/warning.png +0 -0
- data/doc/guides/source/images/polymorphic.png +0 -0
- data/doc/guides/source/images/rails_logo_remix.gif +0 -0
- data/doc/guides/source/images/ruby_on_rails_by_mike_rundle2.gif +0 -0
- data/doc/guides/source/images/session_fixation.png +0 -0
- data/doc/guides/source/index.txt +0 -118
- data/doc/guides/source/layouts_and_rendering.txt +0 -982
- data/doc/guides/source/migrations/anatomy_of_a_migration.txt +0 -85
- data/doc/guides/source/migrations/changelog.txt +0 -5
- data/doc/guides/source/migrations/creating_a_migration.txt +0 -109
- data/doc/guides/source/migrations/foreign_keys.txt +0 -8
- data/doc/guides/source/migrations/index.txt +0 -22
- data/doc/guides/source/migrations/rakeing_around.txt +0 -111
- data/doc/guides/source/migrations/scheming.txt +0 -47
- data/doc/guides/source/migrations/using_models_in_migrations.txt +0 -46
- data/doc/guides/source/migrations/writing_a_migration.txt +0 -159
- data/doc/guides/source/routing_outside_in.txt +0 -986
- data/doc/guides/source/security.txt +0 -984
- data/doc/guides/source/stylesheets/base.css +0 -358
- data/doc/guides/source/stylesheets/forms.css +0 -35
- data/doc/guides/source/stylesheets/more.css +0 -82
- data/doc/guides/source/templates/guides.html.erb +0 -97
- data/doc/guides/source/templates/inline.css +0 -165
- data/doc/guides/source/testing_rails_applications.txt +0 -995
- data/environments/boot.rb +0 -109
- data/environments/development.rb +0 -17
- data/environments/environment.rb +0 -75
- data/environments/production.rb +0 -24
- data/environments/test.rb +0 -22
- data/fresh_rakefile +0 -10
- data/helpers/application.rb +0 -15
- data/helpers/application_helper.rb +0 -3
- data/helpers/performance_test.rb +0 -9
- data/helpers/test_helper.rb +0 -38
- data/html/404.html +0 -30
- data/html/422.html +0 -30
- data/html/500.html +0 -33
- data/html/favicon.ico +0 -0
- data/html/images/rails.png +0 -0
- data/html/index.html +0 -274
- data/html/javascripts/application.js +0 -2
- data/html/javascripts/controls.js +0 -963
- data/html/javascripts/dragdrop.js +0 -973
- data/html/javascripts/effects.js +0 -1128
- data/html/javascripts/prototype.js +0 -4320
- data/html/robots.txt +0 -5
- data/lib/code_statistics.rb +0 -107
- data/lib/commands.rb +0 -17
- data/lib/commands/about.rb +0 -3
- data/lib/commands/console.rb +0 -45
- data/lib/commands/dbconsole.rb +0 -67
- data/lib/commands/destroy.rb +0 -6
- data/lib/commands/generate.rb +0 -6
- data/lib/commands/ncgi/listener +0 -86
- data/lib/commands/ncgi/tracker +0 -69
- data/lib/commands/performance/benchmarker.rb +0 -24
- data/lib/commands/performance/profiler.rb +0 -50
- data/lib/commands/performance/request.rb +0 -6
- data/lib/commands/plugin.rb +0 -967
- data/lib/commands/process/inspector.rb +0 -68
- data/lib/commands/process/reaper.rb +0 -149
- data/lib/commands/process/spawner.rb +0 -219
- data/lib/commands/process/spinner.rb +0 -57
- data/lib/commands/runner.rb +0 -48
- data/lib/commands/server.rb +0 -49
- data/lib/commands/servers/base.rb +0 -31
- data/lib/commands/servers/lighttpd.rb +0 -94
- data/lib/commands/servers/mongrel.rb +0 -69
- data/lib/commands/servers/new_mongrel.rb +0 -16
- data/lib/commands/servers/thin.rb +0 -25
- data/lib/commands/servers/webrick.rb +0 -66
- data/lib/commands/update.rb +0 -4
- data/lib/console_app.rb +0 -30
- data/lib/console_sandbox.rb +0 -6
- data/lib/console_with_helpers.rb +0 -26
- data/lib/dispatcher.rb +0 -24
- data/lib/fcgi_handler.rb +0 -237
- data/lib/initializer.rb +0 -1038
- data/lib/performance_test_help.rb +0 -5
- data/lib/rails/gem_builder.rb +0 -21
- data/lib/rails/gem_dependency.rb +0 -251
- data/lib/rails/mongrel_server/commands.rb +0 -342
- data/lib/rails/mongrel_server/handler.rb +0 -55
- data/lib/rails/plugin.rb +0 -124
- data/lib/rails/plugin/loader.rb +0 -152
- data/lib/rails/plugin/locator.rb +0 -100
- data/lib/rails/rack.rb +0 -6
- data/lib/rails/rack/logger.rb +0 -28
- data/lib/rails/rack/static.rb +0 -35
- data/lib/rails/vendor_gem_source_index.rb +0 -140
- data/lib/rails/version.rb +0 -9
- data/lib/rails_generator.rb +0 -43
- data/lib/rails_generator/base.rb +0 -263
- data/lib/rails_generator/commands.rb +0 -616
- data/lib/rails_generator/generated_attribute.rb +0 -46
- data/lib/rails_generator/generators/applications/app/USAGE +0 -9
- data/lib/rails_generator/generators/applications/app/app_generator.rb +0 -184
- data/lib/rails_generator/generators/components/controller/USAGE +0 -29
- data/lib/rails_generator/generators/components/controller/controller_generator.rb +0 -37
- data/lib/rails_generator/generators/components/controller/templates/controller.rb +0 -7
- data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +0 -8
- data/lib/rails_generator/generators/components/controller/templates/helper.rb +0 -2
- data/lib/rails_generator/generators/components/controller/templates/view.html.erb +0 -2
- data/lib/rails_generator/generators/components/integration_test/USAGE +0 -8
- data/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb +0 -16
- data/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb +0 -10
- data/lib/rails_generator/generators/components/mailer/USAGE +0 -16
- data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +0 -30
- data/lib/rails_generator/generators/components/mailer/templates/fixture.erb +0 -3
- data/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml +0 -0
- data/lib/rails_generator/generators/components/mailer/templates/mailer.rb +0 -15
- data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +0 -20
- data/lib/rails_generator/generators/components/mailer/templates/view.erb +0 -3
- data/lib/rails_generator/generators/components/mailer/templates/view.rhtml +0 -0
- data/lib/rails_generator/generators/components/migration/USAGE +0 -29
- data/lib/rails_generator/generators/components/migration/migration_generator.rb +0 -20
- data/lib/rails_generator/generators/components/migration/templates/migration.rb +0 -11
- data/lib/rails_generator/generators/components/model/USAGE +0 -27
- data/lib/rails_generator/generators/components/model/model_generator.rb +0 -45
- data/lib/rails_generator/generators/components/model/templates/fixtures.yml +0 -19
- data/lib/rails_generator/generators/components/model/templates/migration.rb +0 -16
- data/lib/rails_generator/generators/components/model/templates/model.rb +0 -5
- data/lib/rails_generator/generators/components/model/templates/unit_test.rb +0 -8
- data/lib/rails_generator/generators/components/observer/USAGE +0 -13
- data/lib/rails_generator/generators/components/observer/observer_generator.rb +0 -16
- data/lib/rails_generator/generators/components/observer/templates/observer.rb +0 -2
- data/lib/rails_generator/generators/components/observer/templates/unit_test.rb +0 -8
- data/lib/rails_generator/generators/components/performance_test/USAGE +0 -8
- data/lib/rails_generator/generators/components/performance_test/performance_test_generator.rb +0 -16
- data/lib/rails_generator/generators/components/performance_test/templates/performance_test.rb +0 -9
- data/lib/rails_generator/generators/components/plugin/USAGE +0 -25
- data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +0 -39
- data/lib/rails_generator/generators/components/plugin/templates/MIT-LICENSE +0 -20
- data/lib/rails_generator/generators/components/plugin/templates/README +0 -13
- data/lib/rails_generator/generators/components/plugin/templates/Rakefile +0 -23
- data/lib/rails_generator/generators/components/plugin/templates/USAGE +0 -8
- data/lib/rails_generator/generators/components/plugin/templates/generator.rb +0 -8
- data/lib/rails_generator/generators/components/plugin/templates/init.rb +0 -1
- data/lib/rails_generator/generators/components/plugin/templates/install.rb +0 -1
- data/lib/rails_generator/generators/components/plugin/templates/plugin.rb +0 -1
- data/lib/rails_generator/generators/components/plugin/templates/tasks.rake +0 -4
- data/lib/rails_generator/generators/components/plugin/templates/test_helper.rb +0 -3
- data/lib/rails_generator/generators/components/plugin/templates/uninstall.rb +0 -1
- data/lib/rails_generator/generators/components/plugin/templates/unit_test.rb +0 -8
- data/lib/rails_generator/generators/components/resource/USAGE +0 -23
- data/lib/rails_generator/generators/components/resource/resource_generator.rb +0 -74
- data/lib/rails_generator/generators/components/resource/templates/controller.rb +0 -2
- data/lib/rails_generator/generators/components/resource/templates/functional_test.rb +0 -8
- data/lib/rails_generator/generators/components/resource/templates/helper.rb +0 -2
- data/lib/rails_generator/generators/components/scaffold/USAGE +0 -29
- data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +0 -100
- data/lib/rails_generator/generators/components/scaffold/templates/controller.rb +0 -85
- data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +0 -45
- data/lib/rails_generator/generators/components/scaffold/templates/helper.rb +0 -2
- data/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb +0 -17
- data/lib/rails_generator/generators/components/scaffold/templates/style.css +0 -54
- data/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb +0 -18
- data/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb +0 -24
- data/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb +0 -17
- data/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb +0 -10
- data/lib/rails_generator/generators/components/session_migration/USAGE +0 -10
- data/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb +0 -18
- data/lib/rails_generator/generators/components/session_migration/templates/migration.rb +0 -16
- data/lib/rails_generator/lookup.rb +0 -249
- data/lib/rails_generator/manifest.rb +0 -53
- data/lib/rails_generator/options.rb +0 -150
- data/lib/rails_generator/scripts.rb +0 -89
- data/lib/rails_generator/scripts/destroy.rb +0 -29
- data/lib/rails_generator/scripts/generate.rb +0 -7
- data/lib/rails_generator/scripts/update.rb +0 -12
- data/lib/rails_generator/secret_key_generator.rb +0 -22
- data/lib/rails_generator/simple_logger.rb +0 -46
- data/lib/rails_generator/spec.rb +0 -44
- data/lib/railties_path.rb +0 -1
- data/lib/ruby_version_check.rb +0 -17
- data/lib/rubyprof_ext.rb +0 -35
- data/lib/source_annotation_extractor.rb +0 -102
- data/lib/tasks/annotations.rake +0 -20
- data/lib/tasks/databases.rake +0 -416
- data/lib/tasks/documentation.rake +0 -95
- data/lib/tasks/framework.rake +0 -118
- data/lib/tasks/gems.rake +0 -80
- data/lib/tasks/log.rake +0 -9
- data/lib/tasks/misc.rake +0 -56
- data/lib/tasks/rails.rb +0 -8
- data/lib/tasks/routes.rake +0 -17
- data/lib/tasks/statistics.rake +0 -18
- data/lib/tasks/testing.rake +0 -139
- data/lib/tasks/tmp.rake +0 -37
- data/lib/test_help.rb +0 -27
- data/lib/webrick_server.rb +0 -156
@@ -1,51 +0,0 @@
|
|
1
|
-
# PostgreSQL. Versions 7.4 and 8.x are supported.
|
2
|
-
#
|
3
|
-
# Install the ruby-postgres driver:
|
4
|
-
# gem install ruby-postgres
|
5
|
-
# On Mac OS X:
|
6
|
-
# gem install ruby-postgres -- --include=/usr/local/pgsql
|
7
|
-
# On Windows:
|
8
|
-
# gem install ruby-postgres
|
9
|
-
# Choose the win32 build.
|
10
|
-
# Install PostgreSQL and put its /bin directory on your path.
|
11
|
-
development:
|
12
|
-
adapter: postgresql
|
13
|
-
encoding: unicode
|
14
|
-
database: <%= app_name %>_development
|
15
|
-
pool: 5
|
16
|
-
username: <%= app_name %>
|
17
|
-
password:
|
18
|
-
|
19
|
-
# Connect on a TCP socket. Omitted by default since the client uses a
|
20
|
-
# domain socket that doesn't need configuration. Windows does not have
|
21
|
-
# domain sockets, so uncomment these lines.
|
22
|
-
#host: localhost
|
23
|
-
#port: 5432
|
24
|
-
|
25
|
-
# Schema search path. The server defaults to $user,public
|
26
|
-
#schema_search_path: myapp,sharedapp,public
|
27
|
-
|
28
|
-
# Minimum log levels, in increasing order:
|
29
|
-
# debug5, debug4, debug3, debug2, debug1,
|
30
|
-
# log, notice, warning, error, fatal, and panic
|
31
|
-
# The server defaults to notice.
|
32
|
-
#min_messages: warning
|
33
|
-
|
34
|
-
# Warning: The database defined as "test" will be erased and
|
35
|
-
# re-generated from your development database when you run "rake".
|
36
|
-
# Do not set this db to the same as development or production.
|
37
|
-
test:
|
38
|
-
adapter: postgresql
|
39
|
-
encoding: unicode
|
40
|
-
database: <%= app_name %>_test
|
41
|
-
pool: 5
|
42
|
-
username: <%= app_name %>
|
43
|
-
password:
|
44
|
-
|
45
|
-
production:
|
46
|
-
adapter: postgresql
|
47
|
-
encoding: unicode
|
48
|
-
database: <%= app_name %>_production
|
49
|
-
pool: 5
|
50
|
-
username: <%= app_name %>
|
51
|
-
password:
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# SQLite version 2.x
|
2
|
-
# gem install sqlite-ruby
|
3
|
-
development:
|
4
|
-
adapter: sqlite
|
5
|
-
database: db/development.sqlite2
|
6
|
-
pool: 5
|
7
|
-
|
8
|
-
# Warning: The database defined as "test" will be erased and
|
9
|
-
# re-generated from your development database when you run "rake".
|
10
|
-
# Do not set this db to the same as development or production.
|
11
|
-
test:
|
12
|
-
adapter: sqlite
|
13
|
-
database: db/test.sqlite2
|
14
|
-
pool: 5
|
15
|
-
|
16
|
-
production:
|
17
|
-
adapter: sqlite
|
18
|
-
database: db/production.sqlite2
|
19
|
-
pool: 5
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
-
development:
|
4
|
-
adapter: sqlite3
|
5
|
-
database: db/development.sqlite3
|
6
|
-
pool: 5
|
7
|
-
timeout: 5000
|
8
|
-
|
9
|
-
# Warning: The database defined as "test" will be erased and
|
10
|
-
# re-generated from your development database when you run "rake".
|
11
|
-
# Do not set this db to the same as development or production.
|
12
|
-
test:
|
13
|
-
adapter: sqlite3
|
14
|
-
database: db/test.sqlite3
|
15
|
-
pool: 5
|
16
|
-
timeout: 5000
|
17
|
-
|
18
|
-
production:
|
19
|
-
adapter: sqlite3
|
20
|
-
database: db/production.sqlite3
|
21
|
-
pool: 5
|
22
|
-
timeout: 5000
|
data/configs/empty.log
DELETED
File without changes
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Add new inflection rules using the following format
|
4
|
-
# (all these examples are active by default):
|
5
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
-
# inflect.singular /^(ox)en/i, '\1'
|
8
|
-
# inflect.irregular 'person', 'people'
|
9
|
-
# inflect.uncountable %w( fish sheep )
|
10
|
-
# end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# These settings change the behavior of Rails 2 apps and will be defaults
|
2
|
-
# for Rails 3. You can remove this initializer when Rails 3 is released.
|
3
|
-
|
4
|
-
if defined?(ActiveRecord)
|
5
|
-
# Include Active Record class name as root for JSON serialized output.
|
6
|
-
ActiveRecord::Base.include_root_in_json = true
|
7
|
-
|
8
|
-
# Store the full class name (including module namespace) in STI type column.
|
9
|
-
ActiveRecord::Base.store_full_sti_class = true
|
10
|
-
end
|
11
|
-
|
12
|
-
# Use ISO 8601 format for JSON serialized times and dates.
|
13
|
-
ActiveSupport.use_standard_json_time_format = true
|
14
|
-
|
15
|
-
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
|
16
|
-
# if you're including raw json in an HTML page.
|
17
|
-
ActiveSupport.escape_html_entities_in_json = false
|
data/configs/lighttpd.conf
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# Default configuration file for the lighttpd web server
|
2
|
-
# Start using ./script/server lighttpd
|
3
|
-
|
4
|
-
server.bind = "0.0.0.0"
|
5
|
-
server.port = 3000
|
6
|
-
|
7
|
-
server.modules = ( "mod_rewrite", "mod_accesslog", "mod_fastcgi", "mod_compress", "mod_expire" )
|
8
|
-
|
9
|
-
server.error-handler-404 = "/dispatch.fcgi"
|
10
|
-
server.pid-file = CWD + "/tmp/pids/lighttpd.pid"
|
11
|
-
server.document-root = CWD + "/public/"
|
12
|
-
|
13
|
-
server.errorlog = CWD + "/log/lighttpd.error.log"
|
14
|
-
accesslog.filename = CWD + "/log/lighttpd.access.log"
|
15
|
-
|
16
|
-
url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
|
17
|
-
|
18
|
-
compress.filetype = ( "text/plain", "text/html", "text/css", "text/javascript" )
|
19
|
-
compress.cache-dir = CWD + "/tmp/cache"
|
20
|
-
|
21
|
-
expire.url = ( "/favicon.ico" => "access 3 days",
|
22
|
-
"/images/" => "access 3 days",
|
23
|
-
"/stylesheets/" => "access 3 days",
|
24
|
-
"/javascripts/" => "access 3 days" )
|
25
|
-
|
26
|
-
|
27
|
-
# Change *-procs to 2 if you need to use Upload Progress or other tasks that
|
28
|
-
# *need* to execute a second request while the first is still pending.
|
29
|
-
fastcgi.server = ( ".fcgi" => ( "localhost" => (
|
30
|
-
"min-procs" => 1,
|
31
|
-
"max-procs" => 1,
|
32
|
-
"socket" => CWD + "/tmp/sockets/fcgi.socket",
|
33
|
-
"bin-path" => CWD + "/public/dispatch.fcgi",
|
34
|
-
"bin-environment" => ( "RAILS_ENV" => "development" )
|
35
|
-
) ) )
|
36
|
-
|
37
|
-
mimetype.assign = (
|
38
|
-
".css" => "text/css",
|
39
|
-
".gif" => "image/gif",
|
40
|
-
".htm" => "text/html",
|
41
|
-
".html" => "text/html",
|
42
|
-
".jpeg" => "image/jpeg",
|
43
|
-
".jpg" => "image/jpeg",
|
44
|
-
".js" => "text/javascript",
|
45
|
-
".png" => "image/png",
|
46
|
-
".swf" => "application/x-shockwave-flash",
|
47
|
-
".txt" => "text/plain"
|
48
|
-
)
|
49
|
-
|
50
|
-
# Making sure file uploads above 64k always work when using IE or Safari
|
51
|
-
# For more information, see http://trac.lighttpd.net/trac/ticket/360
|
52
|
-
$HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" {
|
53
|
-
server.max-keep-alive-requests = 0
|
54
|
-
}
|
data/configs/locales/en.yml
DELETED
data/configs/routes.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
ActionController::Routing::Routes.draw do |map|
|
2
|
-
# The priority is based upon order of creation: first created -> highest priority.
|
3
|
-
|
4
|
-
# Sample of regular route:
|
5
|
-
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
6
|
-
# Keep in mind you can assign values other than :controller and :action
|
7
|
-
|
8
|
-
# Sample of named route:
|
9
|
-
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
10
|
-
# This route can be invoked with purchase_url(:id => product.id)
|
11
|
-
|
12
|
-
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
13
|
-
# map.resources :products
|
14
|
-
|
15
|
-
# Sample resource route with options:
|
16
|
-
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
|
17
|
-
|
18
|
-
# Sample resource route with sub-resources:
|
19
|
-
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
|
20
|
-
|
21
|
-
# Sample resource route with more complex sub-resources
|
22
|
-
# map.resources :products do |products|
|
23
|
-
# products.resources :comments
|
24
|
-
# products.resources :sales, :collection => { :recent => :get }
|
25
|
-
# end
|
26
|
-
|
27
|
-
# Sample resource route within a namespace:
|
28
|
-
# map.namespace :admin do |admin|
|
29
|
-
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
|
30
|
-
# admin.resources :products
|
31
|
-
# end
|
32
|
-
|
33
|
-
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
|
34
|
-
# map.root :controller => "welcome"
|
35
|
-
|
36
|
-
# See how all your routes lay out with "rake routes"
|
37
|
-
|
38
|
-
# Install the default routes as the lowest priority.
|
39
|
-
# Note: These default routes make all actions in every controller accessible via GET requests. You should
|
40
|
-
# consider removing the them or commenting them out if you're using named routes and resources.
|
41
|
-
map.connect ':controller/:action/:id'
|
42
|
-
map.connect ':controller/:action/:id.:format'
|
43
|
-
end
|
data/dispatches/dispatch.fcgi
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# You may specify the path to the FastCGI crash log (a log of unhandled
|
4
|
-
# exceptions which forced the FastCGI instance to exit, great for debugging)
|
5
|
-
# and the number of requests to process before running garbage collection.
|
6
|
-
#
|
7
|
-
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
|
8
|
-
# and the GC period is nil (turned off). A reasonable number of requests
|
9
|
-
# could range from 10-100 depending on the memory footprint of your app.
|
10
|
-
#
|
11
|
-
# Example:
|
12
|
-
# # Default log path, normal GC behavior.
|
13
|
-
# RailsFCGIHandler.process!
|
14
|
-
#
|
15
|
-
# # Default log path, 50 requests between GC.
|
16
|
-
# RailsFCGIHandler.process! nil, 50
|
17
|
-
#
|
18
|
-
# # Custom log path, normal GC behavior.
|
19
|
-
# RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
|
20
|
-
#
|
21
|
-
require File.dirname(__FILE__) + "/../config/environment"
|
22
|
-
require 'fcgi_handler'
|
23
|
-
|
24
|
-
RailsFCGIHandler.process!
|
data/dispatches/dispatch.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
|
4
|
-
|
5
|
-
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
|
6
|
-
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
|
7
|
-
require "dispatcher"
|
8
|
-
|
9
|
-
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
|
10
|
-
Dispatcher.dispatch
|
data/dispatches/gateway.cgi
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'drb'
|
4
|
-
|
5
|
-
# This file includes an experimental gateway CGI implementation. It will work
|
6
|
-
# only on platforms which support both fork and sockets.
|
7
|
-
#
|
8
|
-
# To enable it edit public/.htaccess and replace dispatch.cgi with gateway.cgi.
|
9
|
-
#
|
10
|
-
# Next, create the directory log/drb_gateway and grant the apache user rw access
|
11
|
-
# to said directory.
|
12
|
-
#
|
13
|
-
# On the next request to your server, the gateway tracker should start up, along
|
14
|
-
# with a few listener processes. This setup should provide you with much better
|
15
|
-
# speeds than dispatch.cgi.
|
16
|
-
#
|
17
|
-
# Keep in mind that the first request made to the server will be slow, as the
|
18
|
-
# tracker and listeners will have to load. Also, the tracker and listeners will
|
19
|
-
# shutdown after a period if inactivity. You can set this value below -- the
|
20
|
-
# default is 90 seconds.
|
21
|
-
|
22
|
-
TrackerSocket = File.expand_path(File.join(File.dirname(__FILE__), '../log/drb_gateway/tracker.sock'))
|
23
|
-
DieAfter = 90 # Seconds
|
24
|
-
Listeners = 3
|
25
|
-
|
26
|
-
def message(s)
|
27
|
-
$stderr.puts "gateway.cgi: #{s}" if ENV && ENV["DEBUG_GATEWAY"]
|
28
|
-
end
|
29
|
-
|
30
|
-
def listener_socket(number)
|
31
|
-
File.expand_path(File.join(File.dirname(__FILE__), "../log/drb_gateway/listener_#{number}.sock"))
|
32
|
-
end
|
33
|
-
|
34
|
-
unless File.exist? TrackerSocket
|
35
|
-
message "Starting tracker and #{Listeners} listeners"
|
36
|
-
fork do
|
37
|
-
Process.setsid
|
38
|
-
STDIN.reopen "/dev/null"
|
39
|
-
STDOUT.reopen "/dev/null", "a"
|
40
|
-
|
41
|
-
root = File.expand_path(File.dirname(__FILE__) + '/..')
|
42
|
-
|
43
|
-
message "starting tracker"
|
44
|
-
fork do
|
45
|
-
ARGV.clear
|
46
|
-
ARGV << TrackerSocket << Listeners.to_s << DieAfter.to_s
|
47
|
-
load File.join(root, 'script', 'tracker')
|
48
|
-
end
|
49
|
-
|
50
|
-
message "starting listeners"
|
51
|
-
require File.join(root, 'config/environment.rb')
|
52
|
-
Listeners.times do |number|
|
53
|
-
fork do
|
54
|
-
ARGV.clear
|
55
|
-
ARGV << listener_socket(number) << DieAfter.to_s
|
56
|
-
load File.join(root, 'script', 'listener')
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
message "waiting for tracker and listener to arise..."
|
62
|
-
ready = false
|
63
|
-
10.times do
|
64
|
-
sleep 0.5
|
65
|
-
break if (ready = File.exist?(TrackerSocket) && File.exist?(listener_socket(0)))
|
66
|
-
end
|
67
|
-
|
68
|
-
if ready
|
69
|
-
message "tracker and listener are ready"
|
70
|
-
else
|
71
|
-
message "Waited 5 seconds, listener and tracker not ready... dropping request"
|
72
|
-
Kernel.exit 1
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
DRb.start_service
|
77
|
-
|
78
|
-
message "connecting to tracker"
|
79
|
-
tracker = DRbObject.new_with_uri("drbunix:#{TrackerSocket}")
|
80
|
-
|
81
|
-
input = $stdin.read
|
82
|
-
$stdin.close
|
83
|
-
|
84
|
-
env = ENV.inspect
|
85
|
-
|
86
|
-
output = nil
|
87
|
-
tracker.with_listener do |number|
|
88
|
-
message "connecting to listener #{number}"
|
89
|
-
socket = listener_socket(number)
|
90
|
-
listener = DRbObject.new_with_uri("drbunix:#{socket}")
|
91
|
-
output = listener.process(env, input)
|
92
|
-
message "listener #{number} has finished, writing output"
|
93
|
-
end
|
94
|
-
|
95
|
-
$stdout.write output
|
96
|
-
$stdout.flush
|
97
|
-
$stdout.close
|
data/doc/README_FOR_APP
DELETED
@@ -1,1185 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
-
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
3
|
-
<head>
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
5
|
-
<title>Ruby on Rails 2.2 Release Notes</title>
|
6
|
-
<!--[if lt IE 8]>
|
7
|
-
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
|
8
|
-
<![endif]-->
|
9
|
-
<link href="stylesheets/base.css" media="screen" rel="Stylesheet" type="text/css" />
|
10
|
-
<link href="stylesheets/forms.css" media="screen" rel="Stylesheet" type="text/css" />
|
11
|
-
<link href="stylesheets/more.css" media="screen" rel="Stylesheet" type="text/css" />
|
12
|
-
<style type="text/css">
|
13
|
-
div#container {
|
14
|
-
max-width: 900px;
|
15
|
-
padding-bottom: 3em;
|
16
|
-
}
|
17
|
-
|
18
|
-
div#content {
|
19
|
-
margin-left: 200px;
|
20
|
-
}
|
21
|
-
|
22
|
-
div#container.notoc {
|
23
|
-
max-width: 600px;
|
24
|
-
}
|
25
|
-
|
26
|
-
.notoc div#content {
|
27
|
-
margin-left: 0;
|
28
|
-
}
|
29
|
-
|
30
|
-
pre {
|
31
|
-
line-height: 1.4em;
|
32
|
-
}
|
33
|
-
|
34
|
-
#content p tt {
|
35
|
-
background: #eeeeee;
|
36
|
-
border: solid 1px #cccccc;
|
37
|
-
padding: 3px;
|
38
|
-
}
|
39
|
-
|
40
|
-
dt {
|
41
|
-
font-weight: bold;
|
42
|
-
}
|
43
|
-
#
|
44
|
-
#content dt tt {
|
45
|
-
font-size: 10pt;
|
46
|
-
}
|
47
|
-
|
48
|
-
dd {
|
49
|
-
margin-left: 3em;
|
50
|
-
}
|
51
|
-
|
52
|
-
#content dt tt, #content pre tt {
|
53
|
-
background: none;
|
54
|
-
padding: 0;
|
55
|
-
border: 0;
|
56
|
-
}
|
57
|
-
|
58
|
-
#content .olist ol {
|
59
|
-
margin-left: 2em;
|
60
|
-
}
|
61
|
-
|
62
|
-
#header {
|
63
|
-
position: relative;
|
64
|
-
max-width: 840px;
|
65
|
-
margin-left: auto;
|
66
|
-
margin-right: auto;
|
67
|
-
}
|
68
|
-
|
69
|
-
#header.notoc {
|
70
|
-
max-width: 580px;
|
71
|
-
}
|
72
|
-
|
73
|
-
#logo {
|
74
|
-
position: absolute;
|
75
|
-
left: 10px;
|
76
|
-
top: 10px;
|
77
|
-
width: 110px;
|
78
|
-
height: 140px;
|
79
|
-
}
|
80
|
-
|
81
|
-
div#header h1#site_title {
|
82
|
-
background: url('images/ruby_on_rails_by_mike_rundle2.gif') top left no-repeat;
|
83
|
-
position: absolute;
|
84
|
-
width: 392px;
|
85
|
-
height: 55px;
|
86
|
-
left: 145px;
|
87
|
-
top: 20px;
|
88
|
-
margin: 0;
|
89
|
-
padding: 0;
|
90
|
-
}
|
91
|
-
|
92
|
-
#site_title span {
|
93
|
-
display: none;
|
94
|
-
}
|
95
|
-
|
96
|
-
#site_title_tagline {
|
97
|
-
display: none;
|
98
|
-
}
|
99
|
-
|
100
|
-
ul#navMain {
|
101
|
-
position: absolute;
|
102
|
-
margin: 0;
|
103
|
-
padding: 0;
|
104
|
-
top: 97px;
|
105
|
-
left: 145px;
|
106
|
-
}
|
107
|
-
|
108
|
-
.left-floaty, .right-floaty {
|
109
|
-
padding: 15px;
|
110
|
-
}
|
111
|
-
|
112
|
-
.admonitionblock,
|
113
|
-
.tableblock {
|
114
|
-
margin-left: 1em;
|
115
|
-
margin-right: 1em;
|
116
|
-
margin-top: 0.25em;
|
117
|
-
margin-bottom: 1em;
|
118
|
-
}
|
119
|
-
|
120
|
-
.admonitionblock .icon {
|
121
|
-
padding-right: 8px;
|
122
|
-
}
|
123
|
-
|
124
|
-
.admonitionblock .content {
|
125
|
-
border: solid 1px #ffda78;
|
126
|
-
background: #fffebd;
|
127
|
-
padding: 10px;
|
128
|
-
padding-top: 8px;
|
129
|
-
padding-bottom: 8px;
|
130
|
-
}
|
131
|
-
|
132
|
-
.admonitionblock .title {
|
133
|
-
font-size: 140%;
|
134
|
-
margin-bottom: 0.5em;
|
135
|
-
}
|
136
|
-
|
137
|
-
.tableblock table {
|
138
|
-
border: solid 1px #aaaaff;
|
139
|
-
background: #f0f0ff;
|
140
|
-
}
|
141
|
-
|
142
|
-
.tableblock th {
|
143
|
-
background: #e0e0e0;
|
144
|
-
}
|
145
|
-
|
146
|
-
.tableblock th,
|
147
|
-
.tableblock td {
|
148
|
-
padding: 3px;
|
149
|
-
padding-left: 5px;
|
150
|
-
padding-right: 5px;
|
151
|
-
}
|
152
|
-
|
153
|
-
.sidebarblock {
|
154
|
-
margin-top: 0.25em;
|
155
|
-
margin: 1em;
|
156
|
-
border: solid 1px #ccccbb;
|
157
|
-
padding: 8px;
|
158
|
-
background: #ffffe0;
|
159
|
-
}
|
160
|
-
|
161
|
-
.sidebarblock .sidebar-title {
|
162
|
-
font-size: 140%;
|
163
|
-
font-weight: 600;
|
164
|
-
margin-bottom: 0.3em;
|
165
|
-
}
|
166
|
-
|
167
|
-
.sidebarblock .sidebar-content > .para:last-child > p {
|
168
|
-
margin-bottom: 0;
|
169
|
-
}
|
170
|
-
|
171
|
-
.sidebarblock .sidebar-title a {
|
172
|
-
text-decoration: none;
|
173
|
-
}
|
174
|
-
|
175
|
-
.sidebarblock .sidebar-title a:hover {
|
176
|
-
text-decoration: underline;
|
177
|
-
}
|
178
|
-
|
179
|
-
</style>
|
180
|
-
</head>
|
181
|
-
<body>
|
182
|
-
<div id="header" >
|
183
|
-
<div id="logo">
|
184
|
-
<a href="index.html" title="Ruby on Rails"><img src="images/rails_logo_remix.gif" alt="Rails" height="140" width="110" /></a>
|
185
|
-
</div>
|
186
|
-
|
187
|
-
<h1 id="site_title"><span>Ruby on Rails</span></h1>
|
188
|
-
<h2 id="site_title_tagline">Sustainable productivity for web-application development</h2>
|
189
|
-
|
190
|
-
<ul id="navMain">
|
191
|
-
<li class="first-child"><a href="http://www.rubyonrails.org/" title="Ruby on Rails" class="ruby_on_rails">Ruby on Rails</a></li>
|
192
|
-
<li><a class="manuals" href="index.html" title="Manuals Index">Guides Index</a></li>
|
193
|
-
</ul>
|
194
|
-
</div>
|
195
|
-
|
196
|
-
<div id="container">
|
197
|
-
|
198
|
-
<div id="sidebar">
|
199
|
-
<h2>Chapters</h2>
|
200
|
-
<ol>
|
201
|
-
<li>
|
202
|
-
<a href="#_infrastructure">Infrastructure</a>
|
203
|
-
<ul>
|
204
|
-
|
205
|
-
<li><a href="#_internationalization">Internationalization</a></li>
|
206
|
-
|
207
|
-
<li><a href="#_compatibility_with_ruby_1_9_and_jruby">Compatibility with Ruby 1.9 and JRuby</a></li>
|
208
|
-
|
209
|
-
</ul>
|
210
|
-
</li>
|
211
|
-
<li>
|
212
|
-
<a href="#_documentation">Documentation</a>
|
213
|
-
</li>
|
214
|
-
<li>
|
215
|
-
<a href="#_better_integration_with_http_out_of_the_box_etag_support">Better integration with HTTP : Out of the box ETag support</a>
|
216
|
-
</li>
|
217
|
-
<li>
|
218
|
-
<a href="#_thread_safety">Thread Safety</a>
|
219
|
-
</li>
|
220
|
-
<li>
|
221
|
-
<a href="#_active_record">Active Record</a>
|
222
|
-
<ul>
|
223
|
-
|
224
|
-
<li><a href="#_transactional_migrations">Transactional Migrations</a></li>
|
225
|
-
|
226
|
-
<li><a href="#_connection_pooling">Connection Pooling</a></li>
|
227
|
-
|
228
|
-
<li><a href="#_hashes_for_join_table_conditions">Hashes for Join Table Conditions</a></li>
|
229
|
-
|
230
|
-
<li><a href="#_new_dynamic_finders">New Dynamic Finders</a></li>
|
231
|
-
|
232
|
-
<li><a href="#_associations_respect_private_protected_scope">Associations Respect Private/Protected Scope</a></li>
|
233
|
-
|
234
|
-
<li><a href="#_other_activerecord_changes">Other ActiveRecord Changes</a></li>
|
235
|
-
|
236
|
-
</ul>
|
237
|
-
</li>
|
238
|
-
<li>
|
239
|
-
<a href="#_action_controller">Action Controller</a>
|
240
|
-
<ul>
|
241
|
-
|
242
|
-
<li><a href="#_shallow_route_nesting">Shallow Route Nesting</a></li>
|
243
|
-
|
244
|
-
<li><a href="#_method_arrays_for_member_or_collection_routes">Method Arrays for Member or Collection Routes</a></li>
|
245
|
-
|
246
|
-
<li><a href="#_resources_with_specific_actions">Resources With Specific Actions</a></li>
|
247
|
-
|
248
|
-
<li><a href="#_other_action_controller_changes">Other Action Controller Changes</a></li>
|
249
|
-
|
250
|
-
</ul>
|
251
|
-
</li>
|
252
|
-
<li>
|
253
|
-
<a href="#_action_view">Action View</a>
|
254
|
-
</li>
|
255
|
-
<li>
|
256
|
-
<a href="#_action_mailer">Action Mailer</a>
|
257
|
-
</li>
|
258
|
-
<li>
|
259
|
-
<a href="#_active_support">Active Support</a>
|
260
|
-
<ul>
|
261
|
-
|
262
|
-
<li><a href="#_memoization">Memoization</a></li>
|
263
|
-
|
264
|
-
<li><a href="#_tt_each_with_object_tt"><tt>each_with_object</tt></a></li>
|
265
|
-
|
266
|
-
<li><a href="#_delegates_with_prefixes">Delegates With Prefixes</a></li>
|
267
|
-
|
268
|
-
<li><a href="#_other_active_support_changes">Other Active Support Changes</a></li>
|
269
|
-
|
270
|
-
</ul>
|
271
|
-
</li>
|
272
|
-
<li>
|
273
|
-
<a href="#_railties">Railties</a>
|
274
|
-
<ul>
|
275
|
-
|
276
|
-
<li><a href="#_tt_config_gems_tt"><tt>config.gems</tt></a></li>
|
277
|
-
|
278
|
-
<li><a href="#_other_railties_changes">Other Railties Changes</a></li>
|
279
|
-
|
280
|
-
</ul>
|
281
|
-
</li>
|
282
|
-
<li>
|
283
|
-
<a href="#_deprecated">Deprecated</a>
|
284
|
-
</li>
|
285
|
-
<li>
|
286
|
-
<a href="#_credits">Credits</a>
|
287
|
-
</li>
|
288
|
-
</ol>
|
289
|
-
</div>
|
290
|
-
|
291
|
-
<div id="content">
|
292
|
-
<h1>Ruby on Rails 2.2 Release Notes</h1>
|
293
|
-
<div id="preamble">
|
294
|
-
<div class="sectionbody">
|
295
|
-
<div class="para"><p>Rails 2.2 delivers a number of new and improved features. This list covers the major upgrades, but doesn't include every little bug fix and change. If you want to see everything, check out the <a href="http://github.com/rails/rails/commits/master">list of commits</a> in the main Rails repository on GitHub.</p></div>
|
296
|
-
<div class="para"><p>Along with Rails, 2.2 marks the launch of the <a href="http://guides.rubyonrails.org/">Ruby on Rails Guides</a>, the first results of the ongoing <a href="http://hackfest.rubyonrails.org/guide">Rails Guides hackfest</a>. This site will deliver high-quality documentation of the major features of Rails.</p></div>
|
297
|
-
</div>
|
298
|
-
</div>
|
299
|
-
<h2 id="_infrastructure">1. Infrastructure</h2>
|
300
|
-
<div class="sectionbody">
|
301
|
-
<div class="para"><p>Rails 2.2 is a significant release for the infrastructure that keeps Rails humming along and connected to the rest of the world.</p></div>
|
302
|
-
<h3 id="_internationalization">1.1. Internationalization</h3>
|
303
|
-
<div class="para"><p>Rails 2.2 supplies an easy system for internationalization (or i18n, for those of you tired of typing).</p></div>
|
304
|
-
<div class="ilist"><ul>
|
305
|
-
<li>
|
306
|
-
<p>
|
307
|
-
Lead Contributors: Rails i18 Team
|
308
|
-
</p>
|
309
|
-
</li>
|
310
|
-
<li>
|
311
|
-
<p>
|
312
|
-
More information :
|
313
|
-
</p>
|
314
|
-
<div class="ilist"><ul>
|
315
|
-
<li>
|
316
|
-
<p>
|
317
|
-
<a href="http://rails-i18n.org">Official Rails i18 website</a>
|
318
|
-
</p>
|
319
|
-
</li>
|
320
|
-
<li>
|
321
|
-
<p>
|
322
|
-
<a href="http://www.artweb-design.de/2008/7/18/finally-ruby-on-rails-gets-internationalized">Finally. Ruby on Rails gets internationalized</a>
|
323
|
-
</p>
|
324
|
-
</li>
|
325
|
-
<li>
|
326
|
-
<p>
|
327
|
-
<a href="http://i18n-demo.phusion.nl">Localizing Rails : Demo application</a>
|
328
|
-
</p>
|
329
|
-
</li>
|
330
|
-
</ul></div>
|
331
|
-
</li>
|
332
|
-
</ul></div>
|
333
|
-
<h3 id="_compatibility_with_ruby_1_9_and_jruby">1.2. Compatibility with Ruby 1.9 and JRuby</h3>
|
334
|
-
<div class="para"><p>Along with thread safety, a lot of work has been done to make Rails work well with JRuby and the upcoming Ruby 1.9. With Ruby 1.9 being a moving target, running edge Rails on edge Ruby is still a hit-or-miss proposition, but Rails is ready to make the transition to Ruby 1.9 when the latter is released.</p></div>
|
335
|
-
</div>
|
336
|
-
<h2 id="_documentation">2. Documentation</h2>
|
337
|
-
<div class="sectionbody">
|
338
|
-
<div class="para"><p>The internal documentation of Rails, in the form of code comments, has been improved in numerous places. In addition, the <a href="http://guides.rubyonrails.org/">Ruby on Rails Guides</a> project is the definitive source for information on major Rails components. In its first official release, the Guides page includes:</p></div>
|
339
|
-
<div class="ilist"><ul>
|
340
|
-
<li>
|
341
|
-
<p>
|
342
|
-
<a href="http://guides.rubyonrails.org/getting_started_with_rails.html">Getting Started with Rails</a>
|
343
|
-
</p>
|
344
|
-
</li>
|
345
|
-
<li>
|
346
|
-
<p>
|
347
|
-
<a href="http://guides.rubyonrails.org/migrations.html">Rails Database Migrations</a>
|
348
|
-
</p>
|
349
|
-
</li>
|
350
|
-
<li>
|
351
|
-
<p>
|
352
|
-
<a href="http://guides.rubyonrails.org/association_basics.html">Active Record Associations</a>
|
353
|
-
</p>
|
354
|
-
</li>
|
355
|
-
<li>
|
356
|
-
<p>
|
357
|
-
<a href="http://guides.rubyonrails.org/finders.html">Active Record Finders</a>
|
358
|
-
</p>
|
359
|
-
</li>
|
360
|
-
<li>
|
361
|
-
<p>
|
362
|
-
<a href="http://guides.rubyonrails.org/layouts_and_rendering.html">Layouts and Rendering in Rails</a>
|
363
|
-
</p>
|
364
|
-
</li>
|
365
|
-
<li>
|
366
|
-
<p>
|
367
|
-
<a href="http://guides.rubyonrails.org/form_helpers.html">Action View Form Helpers</a>
|
368
|
-
</p>
|
369
|
-
</li>
|
370
|
-
<li>
|
371
|
-
<p>
|
372
|
-
<a href="http://guides.rubyonrails.org/routing_outside_in.html">Rails Routing from the Outside In</a>
|
373
|
-
</p>
|
374
|
-
</li>
|
375
|
-
<li>
|
376
|
-
<p>
|
377
|
-
<a href="http://guides.rubyonrails.org/actioncontroller_basics.html">Basics of Action Controller</a>
|
378
|
-
</p>
|
379
|
-
</li>
|
380
|
-
<li>
|
381
|
-
<p>
|
382
|
-
<a href="http://guides.rubyonrails.org/caching_with_rails.html">Rails Caching</a>
|
383
|
-
</p>
|
384
|
-
</li>
|
385
|
-
<li>
|
386
|
-
<p>
|
387
|
-
<a href="http://guides.rubyonrails.org/testing_rails_applications.html">Testing Rails Applications</a>
|
388
|
-
</p>
|
389
|
-
</li>
|
390
|
-
<li>
|
391
|
-
<p>
|
392
|
-
<a href="http://guides.rubyonrails.org/security.html">Securing Rails Applications</a>
|
393
|
-
</p>
|
394
|
-
</li>
|
395
|
-
<li>
|
396
|
-
<p>
|
397
|
-
<a href="http://guides.rubyonrails.org/debugging_rails_applications.html">Debugging Rails Applications</a>
|
398
|
-
</p>
|
399
|
-
</li>
|
400
|
-
<li>
|
401
|
-
<p>
|
402
|
-
<a href="http://guides.rubyonrails.org/benchmarking_and_profiling.html">Benchmarking and Profiling Rails Applications</a>
|
403
|
-
</p>
|
404
|
-
</li>
|
405
|
-
<li>
|
406
|
-
<p>
|
407
|
-
<a href="http://guides.rubyonrails.org/creating_plugins.html">The Basics of Creating Rails Plugins</a>
|
408
|
-
</p>
|
409
|
-
</li>
|
410
|
-
</ul></div>
|
411
|
-
<div class="para"><p>All told, the Guides provide tens of thousands of words of guidance for beginning and intermediate Rails developers.</p></div>
|
412
|
-
<div class="para"><p>If you want to generate these guides locally, inside your application:</p></div>
|
413
|
-
<div class="listingblock">
|
414
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
415
|
-
by Lorenzo Bettini
|
416
|
-
http://www.lorenzobettini.it
|
417
|
-
http://www.gnu.org/software/src-highlite -->
|
418
|
-
<pre><tt>rake doc<span style="color: #990000">:</span>guides
|
419
|
-
</tt></pre></div></div>
|
420
|
-
<div class="para"><p>This will put the guides inside <tt>RAILS_ROOT/doc/guides</tt> and you may start surfing straight away by opening <tt>RAILS_ROOT/doc/guides/index.html</tt> in your favourite browser.</p></div>
|
421
|
-
<div class="ilist"><ul>
|
422
|
-
<li>
|
423
|
-
<p>
|
424
|
-
Lead Contributors: <a href="http://guides.rails.info/authors.html">Rails Documentation Team</a>
|
425
|
-
</p>
|
426
|
-
</li>
|
427
|
-
<li>
|
428
|
-
<p>
|
429
|
-
Major contributions from <a href="http://advogato.org/person/fxn/diary.html">Xavier Noria</a> and <a href="http://izumi.plan99.net/blog/">Hongli Lai</a>.
|
430
|
-
</p>
|
431
|
-
</li>
|
432
|
-
<li>
|
433
|
-
<p>
|
434
|
-
More information:
|
435
|
-
</p>
|
436
|
-
<div class="ilist"><ul>
|
437
|
-
<li>
|
438
|
-
<p>
|
439
|
-
<a href="http://hackfest.rubyonrails.org/guide">Rails Guides hackfest</a>
|
440
|
-
</p>
|
441
|
-
</li>
|
442
|
-
<li>
|
443
|
-
<p>
|
444
|
-
<a href="http://weblog.rubyonrails.org/2008/5/2/help-improve-rails-documentation-on-git-branch">Help improve Rails documentation on Git branch</a>
|
445
|
-
</p>
|
446
|
-
</li>
|
447
|
-
</ul></div>
|
448
|
-
</li>
|
449
|
-
</ul></div>
|
450
|
-
</div>
|
451
|
-
<h2 id="_better_integration_with_http_out_of_the_box_etag_support">3. Better integration with HTTP : Out of the box ETag support</h2>
|
452
|
-
<div class="sectionbody">
|
453
|
-
<div class="para"><p>Supporting the etag and last modified timestamp in HTTP headers means that Rails can now send back an empty response if it gets a request for a resource that hasn't been modified lately. This allows you to check whether a response needs to be sent at all.</p></div>
|
454
|
-
<div class="listingblock">
|
455
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
456
|
-
by Lorenzo Bettini
|
457
|
-
http://www.lorenzobettini.it
|
458
|
-
http://www.gnu.org/software/src-highlite -->
|
459
|
-
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> ArticlesController <span style="color: #990000"><</span> ApplicationController
|
460
|
-
<span style="font-weight: bold"><span style="color: #0000FF">def</span></span> show_with_respond_to_block
|
461
|
-
<span style="color: #009900">@article</span> <span style="color: #990000">=</span> Article<span style="color: #990000">.</span>find<span style="color: #990000">(</span>params<span style="color: #990000">[:</span>id<span style="color: #990000">])</span>
|
462
|
-
|
463
|
-
<span style="font-style: italic"><span style="color: #9A1900"># If the request sends headers that differs from the options provided to stale?, then</span></span>
|
464
|
-
<span style="font-style: italic"><span style="color: #9A1900"># the request is indeed stale and the respond_to block is triggered (and the options</span></span>
|
465
|
-
<span style="font-style: italic"><span style="color: #9A1900"># to the stale? call is set on the response).</span></span>
|
466
|
-
<span style="font-style: italic"><span style="color: #9A1900">#</span></span>
|
467
|
-
<span style="font-style: italic"><span style="color: #9A1900"># If the request headers match, then the request is fresh and the respond_to block is</span></span>
|
468
|
-
<span style="font-style: italic"><span style="color: #9A1900"># not triggered. Instead the default render will occur, which will check the last-modified</span></span>
|
469
|
-
<span style="font-style: italic"><span style="color: #9A1900"># and etag headers and conclude that it only needs to send a "304 Not Modified" instead</span></span>
|
470
|
-
<span style="font-style: italic"><span style="color: #9A1900"># of rendering the template.</span></span>
|
471
|
-
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> stale?<span style="color: #990000">(:</span>last_modified <span style="color: #990000">=></span> <span style="color: #009900">@article</span><span style="color: #990000">.</span>published_at<span style="color: #990000">.</span>utc<span style="color: #990000">,</span> <span style="color: #990000">:</span>etag <span style="color: #990000">=></span> <span style="color: #009900">@article</span><span style="color: #990000">)</span>
|
472
|
-
respond_to <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>wants<span style="color: #990000">|</span>
|
473
|
-
<span style="font-style: italic"><span style="color: #9A1900"># normal response processing</span></span>
|
474
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
475
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
476
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
477
|
-
|
478
|
-
<span style="font-weight: bold"><span style="color: #0000FF">def</span></span> show_with_implied_render
|
479
|
-
<span style="color: #009900">@article</span> <span style="color: #990000">=</span> Article<span style="color: #990000">.</span>find<span style="color: #990000">(</span>params<span style="color: #990000">[:</span>id<span style="color: #990000">])</span>
|
480
|
-
|
481
|
-
<span style="font-style: italic"><span style="color: #9A1900"># Sets the response headers and checks them against the request, if the request is stale</span></span>
|
482
|
-
<span style="font-style: italic"><span style="color: #9A1900"># (i.e. no match of either etag or last-modified), then the default render of the template happens.</span></span>
|
483
|
-
<span style="font-style: italic"><span style="color: #9A1900"># If the request is fresh, then the default render will return a "304 Not Modified"</span></span>
|
484
|
-
<span style="font-style: italic"><span style="color: #9A1900"># instead of rendering the template.</span></span>
|
485
|
-
fresh_when<span style="color: #990000">(:</span>last_modified <span style="color: #990000">=></span> <span style="color: #009900">@article</span><span style="color: #990000">.</span>published_at<span style="color: #990000">.</span>utc<span style="color: #990000">,</span> <span style="color: #990000">:</span>etag <span style="color: #990000">=></span> <span style="color: #009900">@article</span><span style="color: #990000">)</span>
|
486
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
487
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
488
|
-
</tt></pre></div></div>
|
489
|
-
</div>
|
490
|
-
<h2 id="_thread_safety">4. Thread Safety</h2>
|
491
|
-
<div class="sectionbody">
|
492
|
-
<div class="para"><p>The work done to make Rails thread-safe is rolling out in Rails 2.2. Depending on your web server infrastructure, this means you can handle more requests with fewer copies of Rails in memory, leading to better server performance and higher utilization of multiple cores.</p></div>
|
493
|
-
<div class="para"><p>To enable multithreaded dispatching in production mode of your application, add the following line in your <tt>config/environments/production.rb</tt>:</p></div>
|
494
|
-
<div class="listingblock">
|
495
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
496
|
-
by Lorenzo Bettini
|
497
|
-
http://www.lorenzobettini.it
|
498
|
-
http://www.gnu.org/software/src-highlite -->
|
499
|
-
<pre><tt>config<span style="color: #990000">.</span>threadsafe!
|
500
|
-
</tt></pre></div></div>
|
501
|
-
<div class="ilist"><ul>
|
502
|
-
<li>
|
503
|
-
<p>
|
504
|
-
More information :
|
505
|
-
</p>
|
506
|
-
<div class="ilist"><ul>
|
507
|
-
<li>
|
508
|
-
<p>
|
509
|
-
<a href="http://m.onkey.org/2008/10/23/thread-safety-for-your-rails">Thread safety for your Rails</a>
|
510
|
-
</p>
|
511
|
-
</li>
|
512
|
-
<li>
|
513
|
-
<p>
|
514
|
-
<a href="http://weblog.rubyonrails.org/2008/8/16/josh-peek-officially-joins-the-rails-core">Thread safety project announcement</a>
|
515
|
-
</p>
|
516
|
-
</li>
|
517
|
-
<li>
|
518
|
-
<p>
|
519
|
-
<a href="http://blog.headius.com/2008/08/qa-what-thread-safe-rails-means.html">Q/A: What Thread-safe Rails Means</a>
|
520
|
-
</p>
|
521
|
-
</li>
|
522
|
-
</ul></div>
|
523
|
-
</li>
|
524
|
-
</ul></div>
|
525
|
-
</div>
|
526
|
-
<h2 id="_active_record">5. Active Record</h2>
|
527
|
-
<div class="sectionbody">
|
528
|
-
<div class="para"><p>There are two big additions to talk about here: transactional migrations and pooled database transactions. There's also a new (and cleaner) syntax for join table conditions, as well as a number of smaller improvements.</p></div>
|
529
|
-
<h3 id="_transactional_migrations">5.1. Transactional Migrations</h3>
|
530
|
-
<div class="para"><p>Historically, multiple-step Rails migrations have been a source of trouble. If something went wrong during a migration, everything before the error changed the database and everything after the error wasn't applied. Also, the migration version was stored as having been executed, which means that it couldn't be simply rerun by <tt>rake db:migrate:redo</tt> after you fix the problem. Transactional migrations change this by wrapping migration steps in a DDL transaction, so that if any of them fail, the entire migration is undone. In Rails 2.2, transactional migrations are supported on PostgreSQL out of the box. The code is extensible to other database types in the future - and IBM has already extended it to support the DB2 adapter.</p></div>
|
531
|
-
<div class="ilist"><ul>
|
532
|
-
<li>
|
533
|
-
<p>
|
534
|
-
Lead Contributor: <a href="http://adam.blog.heroku.com/">Adam Wiggins</a>
|
535
|
-
</p>
|
536
|
-
</li>
|
537
|
-
<li>
|
538
|
-
<p>
|
539
|
-
More information:
|
540
|
-
</p>
|
541
|
-
<div class="ilist"><ul>
|
542
|
-
<li>
|
543
|
-
<p>
|
544
|
-
<a href="http://adam.blog.heroku.com/past/2008/9/3/ddl_transactions/">DDL Transactions</a>
|
545
|
-
</p>
|
546
|
-
</li>
|
547
|
-
<li>
|
548
|
-
<p>
|
549
|
-
<a href="http://db2onrails.com/2008/11/08/a-major-milestone-for-db2-on-rails/">A major milestone for DB2 on Rails</a>
|
550
|
-
</p>
|
551
|
-
</li>
|
552
|
-
</ul></div>
|
553
|
-
</li>
|
554
|
-
</ul></div>
|
555
|
-
<h3 id="_connection_pooling">5.2. Connection Pooling</h3>
|
556
|
-
<div class="para"><p>Connection pooling lets Rails distribute database requests across a pool of database connections that will grow to a maximum size (by default 5, but you can add a <tt>pool</tt> key to your <tt>database.yml</tt> to adjust this). This helps remove bottlenecks in applications that support many concurrent users. There's also a <tt>wait_timeout</tt> that defaults to 5 seconds before giving up. <tt>ActiveRecord::Base.connection_pool</tt> gives you direct access to the pool if you need it.</p></div>
|
557
|
-
<div class="listingblock">
|
558
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
559
|
-
by Lorenzo Bettini
|
560
|
-
http://www.lorenzobettini.it
|
561
|
-
http://www.gnu.org/software/src-highlite -->
|
562
|
-
<pre><tt>development<span style="color: #990000">:</span>
|
563
|
-
adapter<span style="color: #990000">:</span> mysql
|
564
|
-
username<span style="color: #990000">:</span> root
|
565
|
-
database<span style="color: #990000">:</span> sample_development
|
566
|
-
pool<span style="color: #990000">:</span> <span style="color: #993399">10</span>
|
567
|
-
wait_timeout<span style="color: #990000">:</span> <span style="color: #993399">10</span>
|
568
|
-
</tt></pre></div></div>
|
569
|
-
<div class="ilist"><ul>
|
570
|
-
<li>
|
571
|
-
<p>
|
572
|
-
Lead Contributor: <a href="http://blog.nicksieger.com/">Nick Sieger</a>
|
573
|
-
</p>
|
574
|
-
</li>
|
575
|
-
<li>
|
576
|
-
<p>
|
577
|
-
More information:
|
578
|
-
</p>
|
579
|
-
<div class="ilist"><ul>
|
580
|
-
<li>
|
581
|
-
<p>
|
582
|
-
<a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-connection-pools">What's New in Edge Rails: Connection Pools</a>
|
583
|
-
</p>
|
584
|
-
</li>
|
585
|
-
</ul></div>
|
586
|
-
</li>
|
587
|
-
</ul></div>
|
588
|
-
<h3 id="_hashes_for_join_table_conditions">5.3. Hashes for Join Table Conditions</h3>
|
589
|
-
<div class="para"><p>You can now specify conditions on join tables using a hash. This is a big help if you need to query across complex joins.</p></div>
|
590
|
-
<div class="listingblock">
|
591
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
592
|
-
by Lorenzo Bettini
|
593
|
-
http://www.lorenzobettini.it
|
594
|
-
http://www.gnu.org/software/src-highlite -->
|
595
|
-
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Photo <span style="color: #990000"><</span> ActiveRecord<span style="color: #990000">::</span>Base
|
596
|
-
belongs_to <span style="color: #990000">:</span>product
|
597
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
598
|
-
|
599
|
-
<span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Product <span style="color: #990000"><</span> ActiveRecord<span style="color: #990000">::</span>Base
|
600
|
-
has_many <span style="color: #990000">:</span>photos
|
601
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
602
|
-
|
603
|
-
<span style="font-style: italic"><span style="color: #9A1900"># Get all products with copyright-free photos:</span></span>
|
604
|
-
Product<span style="color: #990000">.</span>all<span style="color: #990000">(:</span>joins <span style="color: #990000">=></span> <span style="color: #990000">:</span>photos<span style="color: #990000">,</span> <span style="color: #990000">:</span>conditions <span style="color: #990000">=></span> <span style="color: #FF0000">{</span> <span style="color: #990000">:</span>photos <span style="color: #990000">=></span> <span style="color: #FF0000">{</span> <span style="color: #990000">:</span>copyright <span style="color: #990000">=></span> <span style="font-weight: bold"><span style="color: #0000FF">false</span></span> <span style="color: #FF0000">}}</span><span style="color: #990000">)</span>
|
605
|
-
</tt></pre></div></div>
|
606
|
-
<div class="ilist"><ul>
|
607
|
-
<li>
|
608
|
-
<p>
|
609
|
-
More information:
|
610
|
-
</p>
|
611
|
-
<div class="ilist"><ul>
|
612
|
-
<li>
|
613
|
-
<p>
|
614
|
-
<a href="http://ryandaigle.com/articles/2008/7/7/what-s-new-in-edge-rails-easy-join-table-conditions">What's New in Edge Rails: Easy Join Table Conditions</a>
|
615
|
-
</p>
|
616
|
-
</li>
|
617
|
-
</ul></div>
|
618
|
-
</li>
|
619
|
-
</ul></div>
|
620
|
-
<h3 id="_new_dynamic_finders">5.4. New Dynamic Finders</h3>
|
621
|
-
<div class="para"><p>Two new sets of methods have been added to Active Record's dynamic finders family.</p></div>
|
622
|
-
<h4 id="_tt_find_last_by_lt_attribute_gt_tt">5.4.1. <tt>find_last_by_<attribute></tt></h4>
|
623
|
-
<div class="para"><p>The <tt>find_last_by_<attribute></tt> method is equivalent to <tt>Model.last(:conditions ⇒ {:attribute ⇒ value})</tt></p></div>
|
624
|
-
<div class="listingblock">
|
625
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
626
|
-
by Lorenzo Bettini
|
627
|
-
http://www.lorenzobettini.it
|
628
|
-
http://www.gnu.org/software/src-highlite -->
|
629
|
-
<pre><tt><span style="font-style: italic"><span style="color: #9A1900"># Get the last user who signed up from London</span></span>
|
630
|
-
User<span style="color: #990000">.</span>find_last_by_city<span style="color: #990000">(</span><span style="color: #FF0000">'London'</span><span style="color: #990000">)</span>
|
631
|
-
</tt></pre></div></div>
|
632
|
-
<div class="ilist"><ul>
|
633
|
-
<li>
|
634
|
-
<p>
|
635
|
-
Lead Contributor: <a href="http://www.workingwithrails.com/person/9147-emilio-tagua">Emilio Tagua</a>
|
636
|
-
</p>
|
637
|
-
</li>
|
638
|
-
</ul></div>
|
639
|
-
<h4 id="_tt_find_by_lt_attribute_gt_tt">5.4.2. <tt>find_by_<attribute>!</tt></h4>
|
640
|
-
<div class="para"><p>The new bang! version of <tt>find_by_<attribute>!</tt> is equivalent to <tt>Model.first(:conditions ⇒ {:attribute ⇒ value}) || raise ActiveRecord::RecordNotFound</tt> Instead of returning <tt>nil</tt> if it can't find a matching record, this method will raise an exception if it cannot find a match.</p></div>
|
641
|
-
<div class="listingblock">
|
642
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
643
|
-
by Lorenzo Bettini
|
644
|
-
http://www.lorenzobettini.it
|
645
|
-
http://www.gnu.org/software/src-highlite -->
|
646
|
-
<pre><tt><span style="font-style: italic"><span style="color: #9A1900"># Raise ActiveRecord::RecordNotFound exception if 'Moby' hasn't signed up yet!</span></span>
|
647
|
-
User<span style="color: #990000">.</span>find_by_name!<span style="color: #990000">(</span><span style="color: #FF0000">'Moby'</span><span style="color: #990000">)</span>
|
648
|
-
</tt></pre></div></div>
|
649
|
-
<div class="ilist"><ul>
|
650
|
-
<li>
|
651
|
-
<p>
|
652
|
-
Lead Contributor: <a href="http://blog.hasmanythrough.com">Josh Susser</a>
|
653
|
-
</p>
|
654
|
-
</li>
|
655
|
-
</ul></div>
|
656
|
-
<h3 id="_associations_respect_private_protected_scope">5.5. Associations Respect Private/Protected Scope</h3>
|
657
|
-
<div class="para"><p>Active Record association proxies now respect the scope of methods on the proxied object. Previously (given User has_one :account) <tt>@user.account.private_method</tt> would call the private method on the associated Account object. That fails in Rails 2.2; if you need this functionality, you should use <tt>@user.account.send(:private_method)</tt> (or make the method public instead of private or protected). Please note that if you're overriding <tt>method_missing</tt>, you should also override <tt>respond_to</tt> to match the behavior in order for associations to function normally.</p></div>
|
658
|
-
<div class="ilist"><ul>
|
659
|
-
<li>
|
660
|
-
<p>
|
661
|
-
Lead Contributor: Adam Milligan
|
662
|
-
</p>
|
663
|
-
</li>
|
664
|
-
<li>
|
665
|
-
<p>
|
666
|
-
More information:
|
667
|
-
</p>
|
668
|
-
<div class="ilist"><ul>
|
669
|
-
<li>
|
670
|
-
<p>
|
671
|
-
<a href="http://afreshcup.com/2008/10/24/rails-22-change-private-methods-on-association-proxies-are-private/">Rails 2.2 Change: Private Methods on Association Proxies are Private</a>
|
672
|
-
</p>
|
673
|
-
</li>
|
674
|
-
</ul></div>
|
675
|
-
</li>
|
676
|
-
</ul></div>
|
677
|
-
<h3 id="_other_activerecord_changes">5.6. Other ActiveRecord Changes</h3>
|
678
|
-
<div class="ilist"><ul>
|
679
|
-
<li>
|
680
|
-
<p>
|
681
|
-
<tt>rake db:migrate:redo</tt> now accepts an optional VERSION to target that specific migration to redo
|
682
|
-
</p>
|
683
|
-
</li>
|
684
|
-
<li>
|
685
|
-
<p>
|
686
|
-
Set <tt>config.active_record.timestamped_migrations = false</tt> to have migrations with numeric prefix instead of UTC timestamp.
|
687
|
-
</p>
|
688
|
-
</li>
|
689
|
-
<li>
|
690
|
-
<p>
|
691
|
-
Counter cache columns (for associations declared with <tt>:counter_cache ⇒ true</tt>) do not need to be initialized to zero any longer.
|
692
|
-
</p>
|
693
|
-
</li>
|
694
|
-
<li>
|
695
|
-
<p>
|
696
|
-
<tt>ActiveRecord::Base.human_name</tt> for an internationalization-aware humane translation of model names
|
697
|
-
</p>
|
698
|
-
</li>
|
699
|
-
</ul></div>
|
700
|
-
</div>
|
701
|
-
<h2 id="_action_controller">6. Action Controller</h2>
|
702
|
-
<div class="sectionbody">
|
703
|
-
<div class="para"><p>On the controller side, there are several changes that will help tidy up your routes. There are also some internal changes in the routing engine to lower memory usage on complex applications.</p></div>
|
704
|
-
<h3 id="_shallow_route_nesting">6.1. Shallow Route Nesting</h3>
|
705
|
-
<div class="para"><p>Shallow route nesting provides a solution to the well-known difficulty of using deeply-nested resources. With shallow nesting, you need only supply enough information to uniquely identify the resource that you want to work with.</p></div>
|
706
|
-
<div class="listingblock">
|
707
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
708
|
-
by Lorenzo Bettini
|
709
|
-
http://www.lorenzobettini.it
|
710
|
-
http://www.gnu.org/software/src-highlite -->
|
711
|
-
<pre><tt>map<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>publishers<span style="color: #990000">,</span> <span style="color: #990000">:</span>shallow <span style="color: #990000">=></span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>publisher<span style="color: #990000">|</span>
|
712
|
-
publisher<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>magazines <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>magazine<span style="color: #990000">|</span>
|
713
|
-
magazine<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>photos
|
714
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
715
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
716
|
-
</tt></pre></div></div>
|
717
|
-
<div class="para"><p>This will enable recognition of (among others) these routes:</p></div>
|
718
|
-
<div class="listingblock">
|
719
|
-
<div class="content">
|
720
|
-
<pre><tt>/publishers/1 ==> publisher_path(1)
|
721
|
-
/publishers/1/magazines ==> publisher_magazines_path(1)
|
722
|
-
/magazines/2 ==> magazine_path(2)
|
723
|
-
/magazines/2/photos ==> magazines_photos_path(2)
|
724
|
-
/photos/3 ==> photo_path(3)</tt></pre>
|
725
|
-
</div></div>
|
726
|
-
<div class="ilist"><ul>
|
727
|
-
<li>
|
728
|
-
<p>
|
729
|
-
Lead Contributor: <a href="http://www.unwwwired.net/">S. Brent Faulkner</a>
|
730
|
-
</p>
|
731
|
-
</li>
|
732
|
-
<li>
|
733
|
-
<p>
|
734
|
-
More information:
|
735
|
-
</p>
|
736
|
-
<div class="ilist"><ul>
|
737
|
-
<li>
|
738
|
-
<p>
|
739
|
-
<a href="http://guides.rails.info/routing/routing_outside_in.html#_nested_resources">Rails Routing from the Outside In</a>
|
740
|
-
</p>
|
741
|
-
</li>
|
742
|
-
<li>
|
743
|
-
<p>
|
744
|
-
<a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-shallow-routes">What's New in Edge Rails: Shallow Routes</a>
|
745
|
-
</p>
|
746
|
-
</li>
|
747
|
-
</ul></div>
|
748
|
-
</li>
|
749
|
-
</ul></div>
|
750
|
-
<h3 id="_method_arrays_for_member_or_collection_routes">6.2. Method Arrays for Member or Collection Routes</h3>
|
751
|
-
<div class="para"><p>You can now supply an array of methods for new member or collection routes. This removes the annoyance of having to define a route as accepting any verb as soon as you need it to handle more than one. With Rails 2.2, this is a legitimate route declaration:</p></div>
|
752
|
-
<div class="listingblock">
|
753
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
754
|
-
by Lorenzo Bettini
|
755
|
-
http://www.lorenzobettini.it
|
756
|
-
http://www.gnu.org/software/src-highlite -->
|
757
|
-
<pre><tt>map<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>photos<span style="color: #990000">,</span> <span style="color: #990000">:</span>collection <span style="color: #990000">=></span> <span style="color: #FF0000">{</span> <span style="color: #990000">:</span>search <span style="color: #990000">=></span> <span style="color: #990000">[:</span>get<span style="color: #990000">,</span> <span style="color: #990000">:</span>post<span style="color: #990000">]</span> <span style="color: #FF0000">}</span>
|
758
|
-
</tt></pre></div></div>
|
759
|
-
<div class="ilist"><ul>
|
760
|
-
<li>
|
761
|
-
<p>
|
762
|
-
Lead Contributor: <a href="http://brennandunn.com/">Brennan Dunn</a>
|
763
|
-
</p>
|
764
|
-
</li>
|
765
|
-
</ul></div>
|
766
|
-
<h3 id="_resources_with_specific_actions">6.3. Resources With Specific Actions</h3>
|
767
|
-
<div class="para"><p>By default, when you use <tt>map.resources</tt> to create a route, Rails generates routes for seven default actions (index, show, create, new, edit, update, and destroy). But each of these routes takes up memory in your application, and causes Rails to generate additional routing logic. Now you can use the <tt>:only</tt> and <tt>:except</tt> options to fine-tune the routes that Rails will generate for resources. You can supply a single action, an array of actions, or the special <tt>:all</tt> or <tt>:none</tt> options. These options are inherited by nested resources.</p></div>
|
768
|
-
<div class="listingblock">
|
769
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
770
|
-
by Lorenzo Bettini
|
771
|
-
http://www.lorenzobettini.it
|
772
|
-
http://www.gnu.org/software/src-highlite -->
|
773
|
-
<pre><tt>map<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>photos<span style="color: #990000">,</span> <span style="color: #990000">:</span>only <span style="color: #990000">=></span> <span style="color: #990000">[:</span>index<span style="color: #990000">,</span> <span style="color: #990000">:</span>show<span style="color: #990000">]</span>
|
774
|
-
map<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>products<span style="color: #990000">,</span> <span style="color: #990000">:</span>except <span style="color: #990000">=></span> <span style="color: #990000">:</span>destroy
|
775
|
-
</tt></pre></div></div>
|
776
|
-
<div class="ilist"><ul>
|
777
|
-
<li>
|
778
|
-
<p>
|
779
|
-
Lead Contributor: <a href="http://experthuman.com/">Tom Stuart</a>
|
780
|
-
</p>
|
781
|
-
</li>
|
782
|
-
</ul></div>
|
783
|
-
<h3 id="_other_action_controller_changes">6.4. Other Action Controller Changes</h3>
|
784
|
-
<div class="ilist"><ul>
|
785
|
-
<li>
|
786
|
-
<p>
|
787
|
-
You can now easily <a href="http://m.onkey.org/2008/7/20/rescue-from-dispatching">show a custom error page</a> for exceptions raised while routing a request.
|
788
|
-
</p>
|
789
|
-
</li>
|
790
|
-
<li>
|
791
|
-
<p>
|
792
|
-
The HTTP Accept header is disabled by default now. You should prefer the use of formatted URLs (such as <tt>/customers/1.xml</tt>) to indicate the format that you want. If you need the Accept headers, you can turn them back on with <tt>config.action_controller.user_accept_header = true</tt>.
|
793
|
-
</p>
|
794
|
-
</li>
|
795
|
-
<li>
|
796
|
-
<p>
|
797
|
-
Benchmarking numbers are now reported in milliseconds rather than tiny fractions of seconds
|
798
|
-
</p>
|
799
|
-
</li>
|
800
|
-
<li>
|
801
|
-
<p>
|
802
|
-
Rails now supports HTTP-only cookies (and uses them for sessions), which help mitigate some cross-site scripting risks in newer browsers.
|
803
|
-
</p>
|
804
|
-
</li>
|
805
|
-
<li>
|
806
|
-
<p>
|
807
|
-
<tt>redirect_to</tt> now fully supports URI schemes (so, for example, you can redirect to a svn+ssh: URI).
|
808
|
-
</p>
|
809
|
-
</li>
|
810
|
-
<li>
|
811
|
-
<p>
|
812
|
-
<tt>render</tt> now supports a <tt>:js</tt> option to render plain vanilla javascript with the right mime type.
|
813
|
-
</p>
|
814
|
-
</li>
|
815
|
-
<li>
|
816
|
-
<p>
|
817
|
-
Request forgery protection has been tightened up to apply to HTML-formatted content requests only.
|
818
|
-
</p>
|
819
|
-
</li>
|
820
|
-
<li>
|
821
|
-
<p>
|
822
|
-
Polymorphic URLs behave more sensibly if a passed parameter is nil. For example, calling <tt>polymorphic_path([@project, @date, @area])</tt> with a nil date will give you <tt>project_area_path</tt>.
|
823
|
-
</p>
|
824
|
-
</li>
|
825
|
-
</ul></div>
|
826
|
-
</div>
|
827
|
-
<h2 id="_action_view">7. Action View</h2>
|
828
|
-
<div class="sectionbody">
|
829
|
-
<div class="ilist"><ul>
|
830
|
-
<li>
|
831
|
-
<p>
|
832
|
-
<tt>javascript_include_tag</tt> and <tt>stylesheet_link_tag</tt> support a new <tt>:recursive</tt> option to be used along with <tt>:all</tt>, so that you can load an entire tree of files with a single line of code.
|
833
|
-
</p>
|
834
|
-
</li>
|
835
|
-
<li>
|
836
|
-
<p>
|
837
|
-
The included Prototype javascript library has been upgraded to version 1.6.0.3.
|
838
|
-
</p>
|
839
|
-
</li>
|
840
|
-
<li>
|
841
|
-
<p>
|
842
|
-
<tt>RJS#page.reload</tt> to reload the browser's current location via javascript
|
843
|
-
</p>
|
844
|
-
</li>
|
845
|
-
<li>
|
846
|
-
<p>
|
847
|
-
The <tt>atom_feed</tt> helper now takes an <tt>:instruct</tt> option to let you insert XML processing instructions.
|
848
|
-
</p>
|
849
|
-
</li>
|
850
|
-
</ul></div>
|
851
|
-
</div>
|
852
|
-
<h2 id="_action_mailer">8. Action Mailer</h2>
|
853
|
-
<div class="sectionbody">
|
854
|
-
<div class="para"><p>Action Mailer now supports mailer layouts. You can make your HTML emails as pretty as your in-browser views by supplying an appropriately-named layout - for example, the <tt>CustomerMailer</tt> class expects to use <tt>layouts/customer_mailer.html.erb</tt>.</p></div>
|
855
|
-
<div class="ilist"><ul>
|
856
|
-
<li>
|
857
|
-
<p>
|
858
|
-
More information:
|
859
|
-
</p>
|
860
|
-
<div class="ilist"><ul>
|
861
|
-
<li>
|
862
|
-
<p>
|
863
|
-
<a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-mailer-layouts">What's New in Edge Rails: Mailer Layouts</a>
|
864
|
-
</p>
|
865
|
-
</li>
|
866
|
-
</ul></div>
|
867
|
-
</li>
|
868
|
-
</ul></div>
|
869
|
-
<div class="para"><p>Action Mailer now offers built-in support for GMail's SMTP servers, by turning on STARTTLS automatically. This requires Ruby 1.8.7 to be installed.</p></div>
|
870
|
-
</div>
|
871
|
-
<h2 id="_active_support">9. Active Support</h2>
|
872
|
-
<div class="sectionbody">
|
873
|
-
<div class="para"><p>Active Support now offers built-in memoization for Rails applications, the <tt>each_with_object</tt> method, prefix support on delegates, and various other new utility methods.</p></div>
|
874
|
-
<h3 id="_memoization">9.1. Memoization</h3>
|
875
|
-
<div class="para"><p>Memoization is a pattern of initializing a method once and then stashing its value away for repeat use. You've probably used this pattern in your own applications:</p></div>
|
876
|
-
<div class="listingblock">
|
877
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
878
|
-
by Lorenzo Bettini
|
879
|
-
http://www.lorenzobettini.it
|
880
|
-
http://www.gnu.org/software/src-highlite -->
|
881
|
-
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">def</span></span> full_name
|
882
|
-
<span style="color: #009900">@full_name</span> <span style="color: #990000">||=</span> <span style="color: #FF0000">"#{first_name} #{last_name}"</span>
|
883
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
884
|
-
</tt></pre></div></div>
|
885
|
-
<div class="para"><p>Memoization lets you handle this task in a declarative fashion:</p></div>
|
886
|
-
<div class="listingblock">
|
887
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
888
|
-
by Lorenzo Bettini
|
889
|
-
http://www.lorenzobettini.it
|
890
|
-
http://www.gnu.org/software/src-highlite -->
|
891
|
-
<pre><tt>extend ActiveSupport<span style="color: #990000">::</span>Memoizable
|
892
|
-
|
893
|
-
<span style="font-weight: bold"><span style="color: #0000FF">def</span></span> full_name
|
894
|
-
<span style="color: #FF0000">"#{first_name} #{last_name}"</span>
|
895
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
896
|
-
memoize <span style="color: #990000">:</span>full_name
|
897
|
-
</tt></pre></div></div>
|
898
|
-
<div class="para"><p>Other features of memoization include <tt>unmemoize</tt>, <tt>unmemoize_all</tt>, and <tt>memoize_all</tt> to turn memoization on or off.</p></div>
|
899
|
-
<div class="ilist"><ul>
|
900
|
-
<li>
|
901
|
-
<p>
|
902
|
-
Lead Contributor: <a href="http://joshpeek.com/">Josh Peek</a>
|
903
|
-
</p>
|
904
|
-
</li>
|
905
|
-
<li>
|
906
|
-
<p>
|
907
|
-
More information:
|
908
|
-
</p>
|
909
|
-
<div class="ilist"><ul>
|
910
|
-
<li>
|
911
|
-
<p>
|
912
|
-
<a href="http://ryandaigle.com/articles/2008/7/16/what-s-new-in-edge-rails-memoization">What's New in Edge Rails: Easy Memoization</a>
|
913
|
-
</p>
|
914
|
-
</li>
|
915
|
-
<li>
|
916
|
-
<p>
|
917
|
-
<a href="http://www.railway.at/articles/2008/09/20/a-guide-to-memoization">Memo-what? A Guide to Memoization</a>
|
918
|
-
</p>
|
919
|
-
</li>
|
920
|
-
</ul></div>
|
921
|
-
</li>
|
922
|
-
</ul></div>
|
923
|
-
<h3 id="_tt_each_with_object_tt">9.2. <tt>each_with_object</tt></h3>
|
924
|
-
<div class="para"><p>The <tt>each_with_object</tt> method provides an alternative to <tt>inject</tt>, using a method backported from Ruby 1.9. It iterates over a collection, passing the current element and the memo into the block.</p></div>
|
925
|
-
<div class="listingblock">
|
926
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
927
|
-
by Lorenzo Bettini
|
928
|
-
http://www.lorenzobettini.it
|
929
|
-
http://www.gnu.org/software/src-highlite -->
|
930
|
-
<pre><tt><span style="color: #990000">%</span>w<span style="color: #990000">(</span>foo bar<span style="color: #990000">).</span>each_with_object<span style="color: #990000">(</span><span style="color: #FF0000">{}</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span> <span style="color: #990000">|</span>str<span style="color: #990000">,</span> hsh<span style="color: #990000">|</span> hsh<span style="color: #990000">[</span>str<span style="color: #990000">]</span> <span style="color: #990000">=</span> str<span style="color: #990000">.</span>upcase <span style="color: #FF0000">}</span> <span style="font-style: italic"><span style="color: #9A1900">#=> {'foo' => 'FOO', 'bar' => 'BAR'}</span></span>
|
931
|
-
</tt></pre></div></div>
|
932
|
-
<div class="para"><p>Lead Contributor: <a href="http://therealadam.com/">Adam Keys</a></p></div>
|
933
|
-
<h3 id="_delegates_with_prefixes">9.3. Delegates With Prefixes</h3>
|
934
|
-
<div class="para"><p>If you delegate behavior from one class to another, you can now specify a prefix that will be used to identify the delegated methods. For example:</p></div>
|
935
|
-
<div class="listingblock">
|
936
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
937
|
-
by Lorenzo Bettini
|
938
|
-
http://www.lorenzobettini.it
|
939
|
-
http://www.gnu.org/software/src-highlite -->
|
940
|
-
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Vendor <span style="color: #990000"><</span> ActiveRecord<span style="color: #990000">::</span>Base
|
941
|
-
has_one <span style="color: #990000">:</span>account
|
942
|
-
delegate <span style="color: #990000">:</span>email<span style="color: #990000">,</span> <span style="color: #990000">:</span>password<span style="color: #990000">,</span> <span style="color: #990000">:</span>to <span style="color: #990000">=></span> <span style="color: #990000">:</span>account<span style="color: #990000">,</span> <span style="color: #990000">:</span>prefix <span style="color: #990000">=></span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span>
|
943
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
944
|
-
</tt></pre></div></div>
|
945
|
-
<div class="para"><p>This will produce delegated methods <tt>vendor#account_email</tt> and <tt>vendor#account_password</tt>. You can also specify a custom prefix:</p></div>
|
946
|
-
<div class="listingblock">
|
947
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
948
|
-
by Lorenzo Bettini
|
949
|
-
http://www.lorenzobettini.it
|
950
|
-
http://www.gnu.org/software/src-highlite -->
|
951
|
-
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Vendor <span style="color: #990000"><</span> ActiveRecord<span style="color: #990000">::</span>Base
|
952
|
-
has_one <span style="color: #990000">:</span>account
|
953
|
-
delegate <span style="color: #990000">:</span>email<span style="color: #990000">,</span> <span style="color: #990000">:</span>password<span style="color: #990000">,</span> <span style="color: #990000">:</span>to <span style="color: #990000">=></span> <span style="color: #990000">:</span>account<span style="color: #990000">,</span> <span style="color: #990000">:</span>prefix <span style="color: #990000">=></span> <span style="color: #990000">:</span>owner
|
954
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
955
|
-
</tt></pre></div></div>
|
956
|
-
<div class="para"><p>This will produce delegated methods <tt>vendor#owner_email</tt> and <tt>vendor#owner_password</tt>.</p></div>
|
957
|
-
<div class="para"><p>Lead Contributor: <a href="http://workingwithrails.com/person/5830-daniel-schierbeck">Daniel Schierbeck</a></p></div>
|
958
|
-
<h3 id="_other_active_support_changes">9.4. Other Active Support Changes</h3>
|
959
|
-
<div class="ilist"><ul>
|
960
|
-
<li>
|
961
|
-
<p>
|
962
|
-
Extensive updates to <tt>ActiveSupport::Multibyte</tt>, including Ruby 1.9 compatibility fixes.
|
963
|
-
</p>
|
964
|
-
</li>
|
965
|
-
<li>
|
966
|
-
<p>
|
967
|
-
The addition of <tt>ActiveSupport::Rescuable</tt> allows any class to mix in the <tt>rescue_from</tt> syntax.
|
968
|
-
</p>
|
969
|
-
</li>
|
970
|
-
<li>
|
971
|
-
<p>
|
972
|
-
<tt>past?</tt>, <tt>today?</tt> and <tt>future?</tt> for <tt>Date</tt> and <tt>Time</tt> classes to facilitate date/time comparisons.
|
973
|
-
</p>
|
974
|
-
</li>
|
975
|
-
<li>
|
976
|
-
<p>
|
977
|
-
<tt>Array#second</tt> through <tt>Array#fifth</tt> as aliases for <tt>Array#[1]</tt> through <tt>Array#[4]</tt>
|
978
|
-
</p>
|
979
|
-
</li>
|
980
|
-
<li>
|
981
|
-
<p>
|
982
|
-
<tt>Enumerable#many?</tt> to encapsulate <tt>collection.size > 1</tt>
|
983
|
-
</p>
|
984
|
-
</li>
|
985
|
-
<li>
|
986
|
-
<p>
|
987
|
-
<tt>Inflector#parameterize</tt> produces a URL-ready version of its input, for use in <tt>to_param</tt>.
|
988
|
-
</p>
|
989
|
-
</li>
|
990
|
-
<li>
|
991
|
-
<p>
|
992
|
-
<tt>Time#advance</tt> recognizes fractional days and weeks, so you can do <tt>1.7.weeks.ago</tt>, <tt>1.5.hours.since</tt>, and so on.
|
993
|
-
</p>
|
994
|
-
</li>
|
995
|
-
<li>
|
996
|
-
<p>
|
997
|
-
The included TzInfo library has been upgraded to version 0.3.12.
|
998
|
-
</p>
|
999
|
-
</li>
|
1000
|
-
<li>
|
1001
|
-
<p>
|
1002
|
-
<tt>ActiveSuport::StringInquirer</tt> gives you a pretty way to test for equality in strings: <tt>ActiveSupport::StringInquirer.new("abc").abc? ⇒ true</tt>
|
1003
|
-
</p>
|
1004
|
-
</li>
|
1005
|
-
</ul></div>
|
1006
|
-
</div>
|
1007
|
-
<h2 id="_railties">10. Railties</h2>
|
1008
|
-
<div class="sectionbody">
|
1009
|
-
<div class="para"><p>In Railties (the core code of Rails itself) the biggest changes are in the <tt>config.gems</tt> mechanism.</p></div>
|
1010
|
-
<h3 id="_tt_config_gems_tt">10.1. <tt>config.gems</tt></h3>
|
1011
|
-
<div class="para"><p>To avoid deployment issues and make Rails applications more self-contained, it's possible to place copies of all of the gems that your Rails application requires in <tt>/vendor/gems</tt>. This capability first appeared in Rails 2.1, but it's much more flexible and robust in Rails 2.2, handling complicated dependencies between gems. Gem management in Rails includes these commands:</p></div>
|
1012
|
-
<div class="ilist"><ul>
|
1013
|
-
<li>
|
1014
|
-
<p>
|
1015
|
-
<tt>config.gem <em>gem_name</em></tt> in your <tt>config/environment.rb</tt> file
|
1016
|
-
</p>
|
1017
|
-
</li>
|
1018
|
-
<li>
|
1019
|
-
<p>
|
1020
|
-
<tt>rake gems</tt> to list all configured gems, as well as whether they (and their dependencies) are installed or frozen
|
1021
|
-
</p>
|
1022
|
-
</li>
|
1023
|
-
<li>
|
1024
|
-
<p>
|
1025
|
-
<tt>rake gems:install</tt> to install missing gems to the computer
|
1026
|
-
</p>
|
1027
|
-
</li>
|
1028
|
-
<li>
|
1029
|
-
<p>
|
1030
|
-
<tt>rake gems:unpack</tt> to place a copy of the required gems into <tt>/vendor/gems</tt>
|
1031
|
-
</p>
|
1032
|
-
</li>
|
1033
|
-
<li>
|
1034
|
-
<p>
|
1035
|
-
<tt>rake gems:unpack:dependencies</tt> to get copies of the required gems and their dependencies into <tt>/vendor/gems</tt>
|
1036
|
-
</p>
|
1037
|
-
</li>
|
1038
|
-
<li>
|
1039
|
-
<p>
|
1040
|
-
<tt>rake gems:build</tt> to build any missing native extensions
|
1041
|
-
</p>
|
1042
|
-
</li>
|
1043
|
-
<li>
|
1044
|
-
<p>
|
1045
|
-
<tt>rake gems:refresh_specs</tt> to bring vendored gems created with Rails 2.1 into alignment with the Rails 2.2 way of storing them
|
1046
|
-
</p>
|
1047
|
-
</li>
|
1048
|
-
</ul></div>
|
1049
|
-
<div class="para"><p>You can unpack or install a single gem by specifying <tt>GEM=<em>gem_name</em></tt> on the command line.</p></div>
|
1050
|
-
<div class="ilist"><ul>
|
1051
|
-
<li>
|
1052
|
-
<p>
|
1053
|
-
Lead Contributor: <a href="http://github.com/al2o3cr">Matt Jones</a>
|
1054
|
-
</p>
|
1055
|
-
</li>
|
1056
|
-
<li>
|
1057
|
-
<p>
|
1058
|
-
More information:
|
1059
|
-
</p>
|
1060
|
-
<div class="ilist"><ul>
|
1061
|
-
<li>
|
1062
|
-
<p>
|
1063
|
-
<a href="http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies">What's New in Edge Rails: Gem Dependencies</a>
|
1064
|
-
</p>
|
1065
|
-
</li>
|
1066
|
-
<li>
|
1067
|
-
<p>
|
1068
|
-
<a href="http://afreshcup.com/2008/10/25/rails-212-and-22rc1-update-your-rubygems/">Rails 2.1.2 and 2.2RC1: Update Your RubyGems</a>
|
1069
|
-
</p>
|
1070
|
-
</li>
|
1071
|
-
</ul></div>
|
1072
|
-
</li>
|
1073
|
-
</ul></div>
|
1074
|
-
<h3 id="_other_railties_changes">10.2. Other Railties Changes</h3>
|
1075
|
-
<div class="ilist"><ul>
|
1076
|
-
<li>
|
1077
|
-
<p>
|
1078
|
-
If you're a fan of the <a href="http://code.macournoyer.com/thin/">Thin</a> web server, you'll be happy to know that <tt>script/server</tt> now supports Thin directly.
|
1079
|
-
</p>
|
1080
|
-
</li>
|
1081
|
-
<li>
|
1082
|
-
<p>
|
1083
|
-
<tt>script/plugin install <plugin> -r <revision></tt> now works with git-based as well as svn-based plugins.
|
1084
|
-
</p>
|
1085
|
-
</li>
|
1086
|
-
<li>
|
1087
|
-
<p>
|
1088
|
-
<tt>script/console</tt> now supports a <tt>—debugger</tt> option
|
1089
|
-
</p>
|
1090
|
-
</li>
|
1091
|
-
<li>
|
1092
|
-
<p>
|
1093
|
-
Instructions for setting up a continuous integration server to build Rails itself are included in the Rails source
|
1094
|
-
</p>
|
1095
|
-
</li>
|
1096
|
-
<li>
|
1097
|
-
<p>
|
1098
|
-
<tt>rake notes:custom ANNOTATION=MYFLAG</tt> lets you list out custom annotations.
|
1099
|
-
</p>
|
1100
|
-
</li>
|
1101
|
-
<li>
|
1102
|
-
<p>
|
1103
|
-
Wrapped <tt>Rails.env</tt> in <tt>StringInquirer</tt> so you can do <tt>Rails.env.development?</tt>
|
1104
|
-
</p>
|
1105
|
-
</li>
|
1106
|
-
<li>
|
1107
|
-
<p>
|
1108
|
-
To eliminate deprecation warnings and properly handle gem dependencies, Rails now requires rubygems 1.3.1 or higher.
|
1109
|
-
</p>
|
1110
|
-
</li>
|
1111
|
-
</ul></div>
|
1112
|
-
</div>
|
1113
|
-
<h2 id="_deprecated">11. Deprecated</h2>
|
1114
|
-
<div class="sectionbody">
|
1115
|
-
<div class="para"><p>A few pieces of older code are deprecated in this release:</p></div>
|
1116
|
-
<div class="ilist"><ul>
|
1117
|
-
<li>
|
1118
|
-
<p>
|
1119
|
-
<tt>Rails::SecretKeyGenerator</tt> has been replaced by <tt>ActiveSupport::SecureRandom</tt>
|
1120
|
-
</p>
|
1121
|
-
</li>
|
1122
|
-
<li>
|
1123
|
-
<p>
|
1124
|
-
<tt>render_component</tt> is deprecated. There's a <a href="http://github.com/rails/render_component/tree/master">render_components plugin</a> available if you need this functionality.
|
1125
|
-
</p>
|
1126
|
-
</li>
|
1127
|
-
<li>
|
1128
|
-
<p>
|
1129
|
-
Implicit local assignments when rendering partials has been deprecated.
|
1130
|
-
</p>
|
1131
|
-
</li>
|
1132
|
-
</ul></div>
|
1133
|
-
<div class="listingblock">
|
1134
|
-
<div class="content"><!-- Generator: GNU source-highlight 2.9
|
1135
|
-
by Lorenzo Bettini
|
1136
|
-
http://www.lorenzobettini.it
|
1137
|
-
http://www.gnu.org/software/src-highlite -->
|
1138
|
-
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">def</span></span> partial_with_implicit_local_assignment
|
1139
|
-
<span style="color: #009900">@customer</span> <span style="color: #990000">=</span> Customer<span style="color: #990000">.</span>new<span style="color: #990000">(</span><span style="color: #FF0000">"Marcel"</span><span style="color: #990000">)</span>
|
1140
|
-
render <span style="color: #990000">:</span>partial <span style="color: #990000">=></span> <span style="color: #FF0000">"customer"</span>
|
1141
|
-
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
|
1142
|
-
</tt></pre></div></div>
|
1143
|
-
<div class="para"><p>Previously the above code made available a local variable called <tt>customer</tt> inside the partial <em>customer</em>. You should explicitly pass all the variables via :locals hash now.</p></div>
|
1144
|
-
<div class="ilist"><ul>
|
1145
|
-
<li>
|
1146
|
-
<p>
|
1147
|
-
<tt>country_select</tt> has been removed. See the <a href="http://www.rubyonrails.org/deprecation/list-of-countries">deprecation page</a> for more information and a plugin replacement.
|
1148
|
-
</p>
|
1149
|
-
</li>
|
1150
|
-
<li>
|
1151
|
-
<p>
|
1152
|
-
<tt>ActiveRecord::Base.allow_concurrency</tt> no longer has any effect.
|
1153
|
-
</p>
|
1154
|
-
</li>
|
1155
|
-
<li>
|
1156
|
-
<p>
|
1157
|
-
<tt>ActiveRecord::Errors.default_error_messages</tt> has been deprecated in favor of <tt>I18n.translate(<em>activerecord.errors.messages</em>)</tt>
|
1158
|
-
</p>
|
1159
|
-
</li>
|
1160
|
-
<li>
|
1161
|
-
<p>
|
1162
|
-
The <tt>%s</tt> and <tt>%d</tt> interpolation syntax for internationalization is deprecated.
|
1163
|
-
</p>
|
1164
|
-
</li>
|
1165
|
-
<li>
|
1166
|
-
<p>
|
1167
|
-
<tt>String#chars</tt> has been deprecated in favor of <tt>String#mb_chars</tt>.
|
1168
|
-
</p>
|
1169
|
-
</li>
|
1170
|
-
<li>
|
1171
|
-
<p>
|
1172
|
-
Durations of fractional months or fractional years are deprecated. Use Ruby's core <tt>Date</tt> and <tt>Time</tt> class arithmetic instead.
|
1173
|
-
</p>
|
1174
|
-
</li>
|
1175
|
-
</ul></div>
|
1176
|
-
</div>
|
1177
|
-
<h2 id="_credits">12. Credits</h2>
|
1178
|
-
<div class="sectionbody">
|
1179
|
-
<div class="para"><p>Release notes compiled by <a href="http://afreshcup.com">Mike Gunderloy</a></p></div>
|
1180
|
-
</div>
|
1181
|
-
|
1182
|
-
</div>
|
1183
|
-
</div>
|
1184
|
-
</body>
|
1185
|
-
</html>
|