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,225 +0,0 @@
|
|
1
|
-
Configuring Rails Applications
|
2
|
-
==============================
|
3
|
-
|
4
|
-
This guide covers the configuration and initialization features available to Rails applications. By referring to this guide, you will be able to:
|
5
|
-
|
6
|
-
* Adjust the behavior of your Rails applications
|
7
|
-
* Add additional code to be run at application start time
|
8
|
-
|
9
|
-
== Locations for Initialization Code
|
10
|
-
|
11
|
-
preinitializers
|
12
|
-
environment.rb first
|
13
|
-
env-specific files
|
14
|
-
initializers (load_application_initializers)
|
15
|
-
after-initializer
|
16
|
-
|
17
|
-
== Using a Preinitializer
|
18
|
-
|
19
|
-
== Configuring Rails Components
|
20
|
-
|
21
|
-
=== Configuring Active Record
|
22
|
-
|
23
|
-
=== Configuring Action Controller
|
24
|
-
|
25
|
-
=== Configuring Action View
|
26
|
-
|
27
|
-
=== Configuring Action Mailer
|
28
|
-
|
29
|
-
=== Configuring Active Resource
|
30
|
-
|
31
|
-
=== Configuring Active Support
|
32
|
-
|
33
|
-
== Using Initializers
|
34
|
-
organization, controlling load order
|
35
|
-
|
36
|
-
== Using an After-Initializer
|
37
|
-
|
38
|
-
== Changelog ==
|
39
|
-
|
40
|
-
http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/28[Lighthouse ticket]
|
41
|
-
|
42
|
-
* November 5, 2008: Rough outline by link:../authors.html#mgunderloy[Mike Gunderloy]
|
43
|
-
|
44
|
-
|
45
|
-
actionmailer/lib/action_mailer/base.rb
|
46
|
-
257: cattr_accessor :logger
|
47
|
-
267: cattr_accessor :smtp_settings
|
48
|
-
273: cattr_accessor :sendmail_settings
|
49
|
-
276: cattr_accessor :raise_delivery_errors
|
50
|
-
282: cattr_accessor :perform_deliveries
|
51
|
-
285: cattr_accessor :deliveries
|
52
|
-
288: cattr_accessor :default_charset
|
53
|
-
291: cattr_accessor :default_content_type
|
54
|
-
294: cattr_accessor :default_mime_version
|
55
|
-
297: cattr_accessor :default_implicit_parts_order
|
56
|
-
299: cattr_reader :protected_instance_variables
|
57
|
-
|
58
|
-
actionmailer/Rakefile
|
59
|
-
36: rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
60
|
-
|
61
|
-
actionpack/lib/action_controller/base.rb
|
62
|
-
263: cattr_reader :protected_instance_variables
|
63
|
-
273: cattr_accessor :asset_host
|
64
|
-
279: cattr_accessor :consider_all_requests_local
|
65
|
-
285: cattr_accessor :allow_concurrency
|
66
|
-
317: cattr_accessor :param_parsers
|
67
|
-
321: cattr_accessor :default_charset
|
68
|
-
325: cattr_accessor :logger
|
69
|
-
329: cattr_accessor :resource_action_separator
|
70
|
-
333: cattr_accessor :resources_path_names
|
71
|
-
337: cattr_accessor :request_forgery_protection_token
|
72
|
-
341: cattr_accessor :optimise_named_routes
|
73
|
-
351: cattr_accessor :use_accept_header
|
74
|
-
361: cattr_accessor :relative_url_root
|
75
|
-
|
76
|
-
actionpack/lib/action_controller/caching/pages.rb
|
77
|
-
55: cattr_accessor :page_cache_directory
|
78
|
-
58: cattr_accessor :page_cache_extension
|
79
|
-
|
80
|
-
actionpack/lib/action_controller/caching.rb
|
81
|
-
37: cattr_reader :cache_store
|
82
|
-
48: cattr_accessor :perform_caching
|
83
|
-
|
84
|
-
actionpack/lib/action_controller/dispatcher.rb
|
85
|
-
98: cattr_accessor :error_file_path
|
86
|
-
|
87
|
-
actionpack/lib/action_controller/mime_type.rb
|
88
|
-
24: cattr_reader :html_types, :unverifiable_types
|
89
|
-
|
90
|
-
actionpack/lib/action_controller/rescue.rb
|
91
|
-
36: base.cattr_accessor :rescue_responses
|
92
|
-
40: base.cattr_accessor :rescue_templates
|
93
|
-
|
94
|
-
actionpack/lib/action_controller/session/active_record_store.rb
|
95
|
-
60: cattr_accessor :data_column_name
|
96
|
-
170: cattr_accessor :connection
|
97
|
-
173: cattr_accessor :table_name
|
98
|
-
177: cattr_accessor :session_id_column
|
99
|
-
181: cattr_accessor :data_column
|
100
|
-
282: cattr_accessor :session_class
|
101
|
-
|
102
|
-
actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb
|
103
|
-
44: cattr_accessor :included_tags, :instance_writer => false
|
104
|
-
|
105
|
-
actionpack/lib/action_view/base.rb
|
106
|
-
189: cattr_accessor :debug_rjs
|
107
|
-
193: cattr_accessor :warn_cache_misses
|
108
|
-
|
109
|
-
actionpack/lib/action_view/helpers/active_record_helper.rb
|
110
|
-
7: cattr_accessor :field_error_proc
|
111
|
-
|
112
|
-
actionpack/lib/action_view/helpers/form_helper.rb
|
113
|
-
805: cattr_accessor :default_form_builder
|
114
|
-
|
115
|
-
actionpack/lib/action_view/template_handlers/erb.rb
|
116
|
-
47: cattr_accessor :erb_trim_mode
|
117
|
-
|
118
|
-
actionpack/test/active_record_unit.rb
|
119
|
-
5: cattr_accessor :able_to_connect
|
120
|
-
6: cattr_accessor :connected
|
121
|
-
|
122
|
-
actionpack/test/controller/filters_test.rb
|
123
|
-
286: cattr_accessor :execution_log
|
124
|
-
|
125
|
-
actionpack/test/template/form_options_helper_test.rb
|
126
|
-
3:TZInfo::Timezone.cattr_reader :loaded_zones
|
127
|
-
|
128
|
-
activemodel/lib/active_model/errors.rb
|
129
|
-
28: cattr_accessor :default_error_messages
|
130
|
-
|
131
|
-
activemodel/Rakefile
|
132
|
-
19: rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
133
|
-
|
134
|
-
activerecord/lib/active_record/attribute_methods.rb
|
135
|
-
9: base.cattr_accessor :attribute_types_cached_by_default, :instance_writer => false
|
136
|
-
11: base.cattr_accessor :time_zone_aware_attributes, :instance_writer => false
|
137
|
-
|
138
|
-
activerecord/lib/active_record/base.rb
|
139
|
-
394: cattr_accessor :logger, :instance_writer => false
|
140
|
-
443: cattr_accessor :configurations, :instance_writer => false
|
141
|
-
450: cattr_accessor :primary_key_prefix_type, :instance_writer => false
|
142
|
-
456: cattr_accessor :table_name_prefix, :instance_writer => false
|
143
|
-
461: cattr_accessor :table_name_suffix, :instance_writer => false
|
144
|
-
467: cattr_accessor :pluralize_table_names, :instance_writer => false
|
145
|
-
473: cattr_accessor :colorize_logging, :instance_writer => false
|
146
|
-
478: cattr_accessor :default_timezone, :instance_writer => false
|
147
|
-
487: cattr_accessor :schema_format , :instance_writer => false
|
148
|
-
491: cattr_accessor :timestamped_migrations , :instance_writer => false
|
149
|
-
|
150
|
-
activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
|
151
|
-
11: cattr_accessor :connection_handler, :instance_writer => false
|
152
|
-
|
153
|
-
activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
|
154
|
-
166: cattr_accessor :emulate_booleans
|
155
|
-
|
156
|
-
activerecord/lib/active_record/fixtures.rb
|
157
|
-
498: cattr_accessor :all_loaded_fixtures
|
158
|
-
|
159
|
-
activerecord/lib/active_record/locking/optimistic.rb
|
160
|
-
38: base.cattr_accessor :lock_optimistically, :instance_writer => false
|
161
|
-
|
162
|
-
activerecord/lib/active_record/migration.rb
|
163
|
-
259: cattr_accessor :verbose
|
164
|
-
|
165
|
-
activerecord/lib/active_record/schema_dumper.rb
|
166
|
-
13: cattr_accessor :ignore_tables
|
167
|
-
|
168
|
-
activerecord/lib/active_record/serializers/json_serializer.rb
|
169
|
-
4: base.cattr_accessor :include_root_in_json, :instance_writer => false
|
170
|
-
|
171
|
-
activerecord/Rakefile
|
172
|
-
142: rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
173
|
-
|
174
|
-
activerecord/test/cases/lifecycle_test.rb
|
175
|
-
61: cattr_reader :last_inherited
|
176
|
-
|
177
|
-
activerecord/test/cases/mixin_test.rb
|
178
|
-
9: cattr_accessor :forced_now_time
|
179
|
-
|
180
|
-
activeresource/lib/active_resource/base.rb
|
181
|
-
206: cattr_accessor :logger
|
182
|
-
|
183
|
-
activeresource/Rakefile
|
184
|
-
43: rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
185
|
-
|
186
|
-
activesupport/lib/active_support/buffered_logger.rb
|
187
|
-
17: cattr_accessor :silencer
|
188
|
-
|
189
|
-
activesupport/lib/active_support/cache.rb
|
190
|
-
81: cattr_accessor :logger
|
191
|
-
|
192
|
-
activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
|
193
|
-
5:# cattr_accessor :hair_colors
|
194
|
-
10: def cattr_reader(*syms)
|
195
|
-
29: def cattr_writer(*syms)
|
196
|
-
50: def cattr_accessor(*syms)
|
197
|
-
51: cattr_reader(*syms)
|
198
|
-
52: cattr_writer(*syms)
|
199
|
-
|
200
|
-
activesupport/lib/active_support/core_ext/logger.rb
|
201
|
-
34: cattr_accessor :silencer
|
202
|
-
|
203
|
-
activesupport/test/core_ext/class/attribute_accessor_test.rb
|
204
|
-
6: cattr_accessor :foo
|
205
|
-
7: cattr_accessor :bar, :instance_writer => false
|
206
|
-
|
207
|
-
activesupport/test/core_ext/module/synchronization_test.rb
|
208
|
-
6: @target.cattr_accessor :mutex, :instance_writer => false
|
209
|
-
|
210
|
-
railties/doc/guides/html/creating_plugins.html
|
211
|
-
786: cattr_accessor <span style="color: #990000">:</span>yaffle_text_field<span style="color: #990000">,</span> <span style="color: #990000">:</span>yaffle_date_field
|
212
|
-
860: cattr_accessor <span style="color: #990000">:</span>yaffle_text_field<span style="color: #990000">,</span> <span style="color: #990000">:</span>yaffle_date_field
|
213
|
-
|
214
|
-
railties/lib/rails_generator/base.rb
|
215
|
-
93: cattr_accessor :logger
|
216
|
-
|
217
|
-
railties/Rakefile
|
218
|
-
265: rdoc.options << '--line-numbers' << '--inline-source' << '--accessor' << 'cattr_accessor=object'
|
219
|
-
|
220
|
-
railties/test/rails_info_controller_test.rb
|
221
|
-
12: cattr_accessor :local_request
|
222
|
-
|
223
|
-
Rakefile
|
224
|
-
32: rdoc.options << '-A cattr_accessor=object'
|
225
|
-
|
@@ -1,191 +0,0 @@
|
|
1
|
-
== Add an `acts_as_yaffle` method to Active Record ==
|
2
|
-
|
3
|
-
A common pattern in plugins is to add a method called 'acts_as_something' to models. In this case, you want to write a method called 'acts_as_yaffle' that adds a 'squawk' method to your models.
|
4
|
-
|
5
|
-
To begin, set up your files so that you have:
|
6
|
-
|
7
|
-
*vendor/plugins/yaffle/test/acts_as_yaffle_test.rb*
|
8
|
-
|
9
|
-
[source, ruby]
|
10
|
-
------------------------------------------------------
|
11
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
12
|
-
|
13
|
-
class ActsAsYaffleTest < Test::Unit::TestCase
|
14
|
-
end
|
15
|
-
------------------------------------------------------
|
16
|
-
|
17
|
-
*vendor/plugins/yaffle/lib/yaffle.rb*
|
18
|
-
|
19
|
-
[source, ruby]
|
20
|
-
------------------------------------------------------
|
21
|
-
require 'yaffle/acts_as_yaffle'
|
22
|
-
------------------------------------------------------
|
23
|
-
|
24
|
-
*vendor/plugins/yaffle/lib/yaffle/acts_as_yaffle.rb*
|
25
|
-
|
26
|
-
[source, ruby]
|
27
|
-
------------------------------------------------------
|
28
|
-
module Yaffle
|
29
|
-
# your code will go here
|
30
|
-
end
|
31
|
-
------------------------------------------------------
|
32
|
-
|
33
|
-
Note that after requiring 'acts_as_yaffle' you also have to include it into ActiveRecord::Base so that your plugin methods will be available to the rails models.
|
34
|
-
|
35
|
-
One of the most common plugin patterns for 'acts_as_yaffle' plugins is to structure your file like so:
|
36
|
-
|
37
|
-
*vendor/plugins/yaffle/lib/yaffle/acts_as_yaffle.rb*
|
38
|
-
|
39
|
-
[source, ruby]
|
40
|
-
------------------------------------------------------
|
41
|
-
module Yaffle
|
42
|
-
def self.included(base)
|
43
|
-
base.send :extend, ClassMethods
|
44
|
-
end
|
45
|
-
|
46
|
-
module ClassMethods
|
47
|
-
# any method placed here will apply to classes, like Hickwall
|
48
|
-
def acts_as_something
|
49
|
-
send :include, InstanceMethods
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
module InstanceMethods
|
54
|
-
# any method placed here will apply to instaces, like @hickwall
|
55
|
-
end
|
56
|
-
end
|
57
|
-
------------------------------------------------------
|
58
|
-
|
59
|
-
With structure you can easily separate the methods that will be used for the class (like `Hickwall.some_method`) and the instance (like `@hickwell.some_method`).
|
60
|
-
|
61
|
-
=== Add a class method ===
|
62
|
-
|
63
|
-
This plugin will expect that you've added a method to your model named 'last_squawk'. However, the plugin users might have already defined a method on their model named 'last_squawk' that they use for something else. This plugin will allow the name to be changed by adding a class method called 'yaffle_text_field'.
|
64
|
-
|
65
|
-
To start out, write a failing test that shows the behavior you'd like:
|
66
|
-
|
67
|
-
*vendor/plugins/yaffle/test/acts_as_yaffle_test.rb*
|
68
|
-
|
69
|
-
[source, ruby]
|
70
|
-
------------------------------------------------------
|
71
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
72
|
-
|
73
|
-
class Hickwall < ActiveRecord::Base
|
74
|
-
acts_as_yaffle
|
75
|
-
end
|
76
|
-
|
77
|
-
class Wickwall < ActiveRecord::Base
|
78
|
-
acts_as_yaffle :yaffle_text_field => :last_tweet
|
79
|
-
end
|
80
|
-
|
81
|
-
class ActsAsYaffleTest < Test::Unit::TestCase
|
82
|
-
load_schema
|
83
|
-
|
84
|
-
def test_a_hickwalls_yaffle_text_field_should_be_last_squawk
|
85
|
-
assert_equal "last_squawk", Hickwall.yaffle_text_field
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_a_wickwalls_yaffle_text_field_should_be_last_tweet
|
89
|
-
assert_equal "last_tweet", Wickwall.yaffle_text_field
|
90
|
-
end
|
91
|
-
end
|
92
|
-
------------------------------------------------------
|
93
|
-
|
94
|
-
To make these tests pass, you could modify your `acts_as_yaffle` file like so:
|
95
|
-
|
96
|
-
*vendor/plugins/yaffle/lib/yaffle/acts_as_yaffle.rb*
|
97
|
-
|
98
|
-
[source, ruby]
|
99
|
-
------------------------------------------------------
|
100
|
-
module Yaffle
|
101
|
-
def self.included(base)
|
102
|
-
base.send :extend, ClassMethods
|
103
|
-
end
|
104
|
-
|
105
|
-
module ClassMethods
|
106
|
-
def acts_as_yaffle(options = {})
|
107
|
-
cattr_accessor :yaffle_text_field
|
108
|
-
self.yaffle_text_field = (options[:yaffle_text_field] || :last_squawk).to_s
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
ActiveRecord::Base.send :include, Yaffle
|
114
|
-
------------------------------------------------------
|
115
|
-
|
116
|
-
=== Add an instance method ===
|
117
|
-
|
118
|
-
This plugin will add a method named 'squawk' to any Active Record objects that call 'acts_as_yaffle'. The 'squawk' method will simply set the value of one of the fields in the database.
|
119
|
-
|
120
|
-
To start out, write a failing test that shows the behavior you'd like:
|
121
|
-
|
122
|
-
*vendor/plugins/yaffle/test/acts_as_yaffle_test.rb*
|
123
|
-
|
124
|
-
[source, ruby]
|
125
|
-
------------------------------------------------------
|
126
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
127
|
-
|
128
|
-
class Hickwall < ActiveRecord::Base
|
129
|
-
acts_as_yaffle
|
130
|
-
end
|
131
|
-
|
132
|
-
class Wickwall < ActiveRecord::Base
|
133
|
-
acts_as_yaffle :yaffle_text_field => :last_tweet
|
134
|
-
end
|
135
|
-
|
136
|
-
class ActsAsYaffleTest < Test::Unit::TestCase
|
137
|
-
load_schema
|
138
|
-
|
139
|
-
def test_a_hickwalls_yaffle_text_field_should_be_last_squawk
|
140
|
-
assert_equal "last_squawk", Hickwall.yaffle_text_field
|
141
|
-
end
|
142
|
-
|
143
|
-
def test_a_wickwalls_yaffle_text_field_should_be_last_tweet
|
144
|
-
assert_equal "last_tweet", Wickwall.yaffle_text_field
|
145
|
-
end
|
146
|
-
|
147
|
-
def test_hickwalls_squawk_should_populate_last_squawk
|
148
|
-
hickwall = Hickwall.new
|
149
|
-
hickwall.squawk("Hello World")
|
150
|
-
assert_equal "squawk! Hello World", hickwall.last_squawk
|
151
|
-
end
|
152
|
-
|
153
|
-
def test_wickwalls_squawk_should_populate_last_tweeted_at
|
154
|
-
wickwall = Wickwall.new
|
155
|
-
wickwall.squawk("Hello World")
|
156
|
-
assert_equal "squawk! Hello World", wickwall.last_tweet
|
157
|
-
end
|
158
|
-
end
|
159
|
-
------------------------------------------------------
|
160
|
-
|
161
|
-
Run this test to make sure the last two tests fail, then update 'acts_as_yaffle.rb' to look like this:
|
162
|
-
|
163
|
-
*vendor/plugins/yaffle/lib/yaffle/acts_as_yaffle.rb*
|
164
|
-
|
165
|
-
[source, ruby]
|
166
|
-
------------------------------------------------------
|
167
|
-
module Yaffle
|
168
|
-
def self.included(base)
|
169
|
-
base.send :extend, ClassMethods
|
170
|
-
end
|
171
|
-
|
172
|
-
module ClassMethods
|
173
|
-
def acts_as_yaffle(options = {})
|
174
|
-
cattr_accessor :yaffle_text_field
|
175
|
-
self.yaffle_text_field = (options[:yaffle_text_field] || :last_squawk).to_s
|
176
|
-
send :include, InstanceMethods
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
module InstanceMethods
|
181
|
-
def squawk(string)
|
182
|
-
write_attribute(self.class.yaffle_text_field, string.to_squawk)
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
ActiveRecord::Base.send :include, Yaffle
|
188
|
-
------------------------------------------------------
|
189
|
-
|
190
|
-
.Editor's note:
|
191
|
-
NOTE: The use of `write_attribute` to write to the field in model is just one example of how a plugin can interact with the model, and will not always be the right method to use. For example, you could also use `send("#{self.class.yaffle_text_field}=", string.to_squawk)`.
|
@@ -1,46 +0,0 @@
|
|
1
|
-
== Appendix ==
|
2
|
-
|
3
|
-
=== References ===
|
4
|
-
|
5
|
-
* http://nubyonrails.com/articles/the-complete-guide-to-rails-plugins-part-i
|
6
|
-
* http://nubyonrails.com/articles/2006/05/09/the-complete-guide-to-rails-plugins-part-ii
|
7
|
-
* http://github.com/technoweenie/attachment_fu/tree/master
|
8
|
-
* http://daddy.platte.name/2007/05/rails-plugins-keep-initrb-thin.html
|
9
|
-
|
10
|
-
=== Final plugin directory structure ===
|
11
|
-
|
12
|
-
The final plugin should have a directory structure that looks something like this:
|
13
|
-
|
14
|
-
------------------------------------------------
|
15
|
-
|-- MIT-LICENSE
|
16
|
-
|-- README
|
17
|
-
|-- Rakefile
|
18
|
-
|-- generators
|
19
|
-
| `-- yaffle
|
20
|
-
| |-- USAGE
|
21
|
-
| |-- templates
|
22
|
-
| | `-- definition.txt
|
23
|
-
| `-- yaffle_generator.rb
|
24
|
-
|-- init.rb
|
25
|
-
|-- install.rb
|
26
|
-
|-- lib
|
27
|
-
| |-- acts_as_yaffle.rb
|
28
|
-
| |-- commands.rb
|
29
|
-
| |-- core_ext.rb
|
30
|
-
| |-- routing.rb
|
31
|
-
| `-- view_helpers.rb
|
32
|
-
|-- tasks
|
33
|
-
| `-- yaffle_tasks.rake
|
34
|
-
|-- test
|
35
|
-
| |-- acts_as_yaffle_test.rb
|
36
|
-
| |-- core_ext_test.rb
|
37
|
-
| |-- database.yml
|
38
|
-
| |-- debug.log
|
39
|
-
| |-- routing_test.rb
|
40
|
-
| |-- schema.rb
|
41
|
-
| |-- test_helper.rb
|
42
|
-
| `-- view_helpers_test.rb
|
43
|
-
|-- uninstall.rb
|
44
|
-
`-- yaffle_plugin.sqlite3.db
|
45
|
-
------------------------------------------------
|
46
|
-
|