railties 3.0.0.beta → 3.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +15 -1
- data/README +9 -9
- data/bin/rails +28 -9
- data/guides/images/challenge.png +0 -0
- data/guides/images/edge_badge.png +0 -0
- data/guides/images/posts_index.png +0 -0
- data/guides/images/rails_welcome.png +0 -0
- data/guides/rails_guides.rb +9 -22
- data/guides/rails_guides/generator.rb +79 -50
- data/guides/rails_guides/textile_extensions.rb +3 -3
- data/guides/source/2_2_release_notes.textile +1 -1
- data/guides/source/2_3_release_notes.textile +1 -1
- data/guides/source/3_0_release_notes.textile +46 -38
- data/guides/source/action_controller_overview.textile +2 -2
- data/guides/source/action_mailer_basics.textile +4 -4
- data/guides/source/action_view_overview.textile +2 -2
- data/guides/source/active_record_querying.textile +73 -95
- data/guides/source/active_support_core_extensions.textile +993 -85
- data/guides/source/activerecord_validations_callbacks.textile +3 -3
- data/guides/source/caching_with_rails.textile +1 -1
- data/guides/source/command_line.textile +90 -88
- data/guides/source/configuring.textile +10 -10
- data/guides/source/contribute.textile +2 -2
- data/guides/source/contributing_to_rails.textile +14 -7
- data/guides/source/credits.textile.erb +8 -0
- data/guides/source/debugging_rails_applications.textile +6 -6
- data/guides/source/form_helpers.textile +1 -1
- data/guides/source/generators.textile +14 -14
- data/guides/source/getting_started.textile +634 -500
- data/guides/source/index.textile.erb +16 -1
- data/guides/source/layout.html.erb +7 -1
- data/guides/source/layouts_and_rendering.textile +299 -71
- data/guides/source/migrations.textile +5 -5
- data/guides/source/performance_testing.textile +8 -8
- data/guides/source/plugins.textile +26 -24
- data/guides/source/rails_on_rack.textile +5 -5
- data/guides/source/routing.textile +119 -117
- data/guides/source/security.textile +1 -1
- data/guides/source/testing.textile +4 -4
- data/lib/rails.rb +4 -1
- data/lib/rails/application.rb +44 -7
- data/lib/rails/application/bootstrap.rb +2 -14
- data/lib/rails/application/configuration.rb +69 -5
- data/lib/rails/application/finisher.rb +2 -3
- data/lib/rails/application/metal_loader.rb +1 -1
- data/lib/rails/application/routes_reloader.rb +1 -1
- data/lib/rails/backtrace_cleaner.rb +0 -11
- data/lib/rails/commands.rb +7 -6
- data/lib/rails/commands/application.rb +1 -1
- data/lib/rails/commands/console.rb +1 -1
- data/lib/rails/commands/dbconsole.rb +12 -0
- data/lib/rails/commands/destroy.rb +2 -2
- data/lib/rails/commands/generate.rb +2 -2
- data/lib/rails/commands/performance/benchmarker.rb +2 -2
- data/lib/rails/commands/performance/profiler.rb +2 -2
- data/lib/rails/commands/plugin.rb +6 -6
- data/lib/rails/commands/runner.rb +2 -0
- data/lib/rails/commands/server.rb +23 -8
- data/lib/rails/configuration.rb +2 -84
- data/lib/rails/console/app.rb +4 -3
- data/lib/rails/console/helpers.rb +3 -1
- data/lib/rails/engine.rb +107 -12
- data/lib/rails/engine/configuration.rb +8 -2
- data/lib/rails/generators.rb +22 -7
- data/lib/rails/generators/actions.rb +16 -6
- data/lib/rails/generators/base.rb +15 -8
- data/lib/rails/generators/erb.rb +21 -0
- data/lib/{generators → rails/generators}/erb/controller/controller_generator.rb +4 -5
- data/lib/{generators → rails/generators}/erb/controller/templates/view.html.erb +0 -0
- data/lib/rails/generators/erb/mailer/mailer_generator.rb +13 -0
- data/lib/{generators → rails/generators}/erb/mailer/templates/view.text.erb +0 -0
- data/lib/{generators → rails/generators}/erb/scaffold/scaffold_generator.rb +14 -26
- data/lib/{generators → rails/generators}/erb/scaffold/templates/_form.html.erb +1 -1
- data/lib/{generators → rails/generators}/erb/scaffold/templates/edit.html.erb +0 -0
- data/lib/{generators → rails/generators}/erb/scaffold/templates/index.html.erb +1 -1
- data/lib/{generators → rails/generators}/erb/scaffold/templates/layout.html.erb +1 -0
- data/lib/{generators → rails/generators}/erb/scaffold/templates/new.html.erb +0 -0
- data/lib/{generators → rails/generators}/erb/scaffold/templates/show.html.erb +0 -0
- data/lib/rails/generators/named_base.rb +4 -0
- data/lib/{generators → rails/generators}/rails/app/USAGE +0 -0
- data/lib/{generators → rails/generators}/rails/app/app_generator.rb +21 -7
- data/lib/rails/generators/rails/app/templates/Gemfile +34 -0
- data/lib/{generators → rails/generators}/rails/app/templates/README +9 -8
- data/lib/{generators → rails/generators}/rails/app/templates/Rakefile +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/app/controllers/application_controller.rb +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/app/helpers/application_helper.rb +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/app/models/.empty_directory +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/app/views/layouts/.empty_directory +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config.ru +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/application.rb +4 -3
- data/lib/rails/generators/rails/app/templates/config/boot.rb +14 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/databases/frontbase.yml +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/databases/ibm_db.yml +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/databases/mysql.yml +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/databases/oracle.yml +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/databases/postgresql.yml +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/databases/sqlite3.yml +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/environment.rb +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/environments/development.rb.tt +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/environments/production.rb.tt +9 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/environments/test.rb.tt +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/initializers/backtrace_silencers.rb +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt +1 -1
- data/lib/{generators → rails/generators}/rails/app/templates/config/initializers/inflections.rb +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/initializers/mime_types.rb +0 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +10 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/locales/en.yml +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/config/routes.rb +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/db/seeds.rb +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/doc/README_FOR_APP +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/gitignore +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/public/404.html +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/public/422.html +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/public/500.html +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/public/favicon.ico +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/public/images/rails.png +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/public/index.html +17 -17
- data/lib/{generators → rails/generators}/rails/app/templates/public/javascripts/application.js +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/public/javascripts/controls.js +5 -3
- data/lib/{generators → rails/generators}/rails/app/templates/public/javascripts/dragdrop.js +7 -6
- data/lib/{generators → rails/generators}/rails/app/templates/public/javascripts/effects.js +8 -13
- data/lib/{generators → rails/generators}/rails/app/templates/public/javascripts/prototype.js +1573 -1019
- data/lib/{generators → rails/generators}/rails/app/templates/public/javascripts/rails.js +1 -2
- data/lib/{generators → rails/generators}/rails/app/templates/public/robots.txt +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/public/stylesheets/.empty_directory +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/script/rails +0 -1
- data/lib/{generators → rails/generators}/rails/app/templates/test/fixtures/.empty_directory +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/test/functional/.empty_directory +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/test/integration/.empty_directory +0 -0
- data/lib/{generators → rails/generators}/rails/app/templates/test/performance/browsing_test.rb +1 -1
- data/lib/{generators → rails/generators}/rails/app/templates/test/test_helper.rb +1 -1
- data/lib/{generators → rails/generators}/rails/app/templates/test/unit/.empty_directory +0 -0
- data/lib/{generators → rails/generators}/rails/controller/USAGE +1 -1
- data/lib/{generators → rails/generators}/rails/controller/controller_generator.rb +6 -0
- data/lib/{generators → rails/generators}/rails/controller/templates/controller.rb +0 -0
- data/lib/{generators → rails/generators}/rails/generator/USAGE +1 -1
- data/lib/{generators → rails/generators}/rails/generator/generator_generator.rb +0 -0
- data/lib/{generators → rails/generators}/rails/generator/templates/%file_name%_generator.rb.tt +0 -0
- data/lib/{generators → rails/generators}/rails/generator/templates/USAGE.tt +1 -1
- data/lib/{generators → rails/generators}/rails/generator/templates/templates/.empty_directory +0 -0
- data/lib/{generators → rails/generators}/rails/helper/USAGE +1 -1
- data/lib/{generators → rails/generators}/rails/helper/helper_generator.rb +0 -0
- data/lib/{generators → rails/generators}/rails/helper/templates/helper.rb +0 -0
- data/lib/{generators → rails/generators}/rails/integration_test/USAGE +1 -1
- data/lib/{generators → rails/generators}/rails/integration_test/integration_test_generator.rb +0 -0
- data/lib/{generators → rails/generators}/rails/mailer/USAGE +1 -1
- data/lib/{generators → rails/generators}/rails/mailer/mailer_generator.rb +0 -0
- data/lib/{generators → rails/generators}/rails/mailer/templates/mailer.rb +0 -0
- data/lib/{generators → rails/generators}/rails/metal/USAGE +1 -1
- data/lib/{generators → rails/generators}/rails/metal/metal_generator.rb +0 -0
- data/lib/{generators → rails/generators}/rails/metal/templates/metal.rb +0 -0
- data/lib/{generators → rails/generators}/rails/migration/USAGE +2 -2
- data/lib/{generators → rails/generators}/rails/migration/migration_generator.rb +0 -0
- data/lib/{generators → rails/generators}/rails/model/USAGE +2 -2
- data/lib/{generators → rails/generators}/rails/model/model_generator.rb +0 -0
- data/lib/{generators → rails/generators}/rails/observer/USAGE +1 -1
- data/lib/{generators → rails/generators}/rails/observer/observer_generator.rb +0 -0
- data/lib/{generators → rails/generators}/rails/performance_test/USAGE +1 -1
- data/lib/{generators → rails/generators}/rails/performance_test/performance_test_generator.rb +0 -0
- data/lib/{generators → rails/generators}/rails/plugin/USAGE +1 -1
- data/lib/{generators → rails/generators}/rails/plugin/plugin_generator.rb +1 -1
- data/lib/{generators → rails/generators}/rails/plugin/templates/MIT-LICENSE.tt +0 -0
- data/lib/{generators → rails/generators}/rails/plugin/templates/README.tt +0 -0
- data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +23 -0
- data/lib/{generators → rails/generators}/rails/plugin/templates/init.rb +0 -0
- data/lib/{generators → rails/generators}/rails/plugin/templates/install.rb +0 -0
- data/lib/{generators → rails/generators}/rails/plugin/templates/lib/%file_name%.rb.tt +0 -0
- data/lib/{generators → rails/generators}/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt +0 -0
- data/lib/{generators → rails/generators}/rails/plugin/templates/uninstall.rb +0 -0
- data/lib/{generators → rails/generators}/rails/resource/USAGE +3 -3
- data/lib/{generators → rails/generators}/rails/resource/resource_generator.rb +3 -1
- data/lib/{generators → rails/generators}/rails/scaffold/USAGE +4 -4
- data/lib/{generators → rails/generators}/rails/scaffold/scaffold_generator.rb +1 -1
- data/lib/{generators → rails/generators}/rails/scaffold_controller/USAGE +1 -1
- data/lib/{generators → rails/generators}/rails/scaffold_controller/scaffold_controller_generator.rb +0 -0
- data/lib/{generators → rails/generators}/rails/scaffold_controller/templates/controller.rb +2 -2
- data/lib/{generators → rails/generators}/rails/session_migration/USAGE +1 -1
- data/lib/{generators → rails/generators}/rails/session_migration/session_migration_generator.rb +0 -0
- data/lib/{generators → rails/generators}/rails/stylesheets/USAGE +1 -1
- data/lib/{generators → rails/generators}/rails/stylesheets/stylesheets_generator.rb +0 -0
- data/lib/{generators → rails/generators}/rails/stylesheets/templates/scaffold.css +4 -0
- data/lib/{generators → rails/generators}/test_unit.rb +0 -0
- data/lib/{generators → rails/generators}/test_unit/controller/controller_generator.rb +2 -1
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb +18 -0
- data/lib/{generators → rails/generators}/test_unit/helper/helper_generator.rb +1 -1
- data/lib/{generators → rails/generators}/test_unit/helper/templates/helper_test.rb +0 -0
- data/lib/{generators → rails/generators}/test_unit/integration/integration_generator.rb +1 -1
- data/lib/{generators → rails/generators}/test_unit/integration/templates/integration_test.rb +0 -0
- data/lib/{generators → rails/generators}/test_unit/mailer/mailer_generator.rb +1 -8
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +20 -0
- data/lib/{generators → rails/generators}/test_unit/model/model_generator.rb +1 -1
- data/lib/{generators → rails/generators}/test_unit/model/templates/fixtures.yml +0 -0
- data/lib/{generators → rails/generators}/test_unit/model/templates/unit_test.rb +0 -0
- data/lib/{generators → rails/generators}/test_unit/observer/observer_generator.rb +1 -1
- data/lib/{generators → rails/generators}/test_unit/observer/templates/unit_test.rb +0 -0
- data/lib/{generators → rails/generators}/test_unit/performance/performance_generator.rb +1 -1
- data/lib/{generators → rails/generators}/test_unit/performance/templates/performance_test.rb +0 -0
- data/lib/{generators → rails/generators}/test_unit/plugin/plugin_generator.rb +1 -1
- data/lib/{generators → rails/generators}/test_unit/plugin/templates/%file_name%_test.rb.tt +0 -0
- data/lib/{generators → rails/generators}/test_unit/plugin/templates/test_helper.rb +0 -0
- data/lib/{generators → rails/generators}/test_unit/scaffold/scaffold_generator.rb +1 -1
- data/lib/{generators → rails/generators}/test_unit/scaffold/templates/functional_test.rb +9 -5
- data/{builtin/rails_info → lib}/rails/info.rb +0 -0
- data/{builtin/rails_info → lib}/rails/info_controller.rb +0 -0
- data/{builtin/routes.rb → lib/rails/info_routes.rb} +2 -2
- data/lib/rails/{subscriber.rb → log_subscriber.rb} +27 -27
- data/lib/rails/{subscriber → log_subscriber}/test_helper.rb +15 -16
- data/lib/rails/plugin.rb +31 -8
- data/lib/rails/rack/debugger.rb +3 -1
- data/lib/rails/rack/logger.rb +4 -4
- data/lib/rails/railtie.rb +179 -16
- data/lib/rails/railtie/configuration.rb +56 -1
- data/lib/rails/tasks/documentation.rake +38 -20
- data/lib/rails/tasks/framework.rake +16 -9
- data/lib/rails/tasks/misc.rake +3 -5
- data/lib/rails/tasks/routes.rake +2 -2
- data/lib/rails/test_help.rb +21 -1
- data/lib/rails/test_unit/railtie.rb +1 -3
- data/lib/rails/version.rb +3 -2
- metadata +199 -171
- data/builtin/rails_info/rails/info_helper.rb +0 -2
- data/lib/generators/erb.rb +0 -8
- data/lib/generators/erb/mailer/mailer_generator.rb +0 -20
- data/lib/generators/rails/app/templates/Gemfile +0 -34
- data/lib/generators/rails/app/templates/config/boot.rb +0 -17
- data/lib/generators/rails/app/templates/config/initializers/session_store.rb.tt +0 -15
- data/lib/generators/rails/model_subclass/model_subclass_generator.rb +0 -12
- data/lib/generators/rails/plugin/templates/Rakefile.tt +0 -10
- data/lib/generators/test_unit/controller/templates/functional_test.rb +0 -8
- data/lib/generators/test_unit/mailer/templates/fixture +0 -3
- data/lib/generators/test_unit/mailer/templates/functional_test.rb +0 -22
- data/lib/rails/railties_path.rb +0 -1
data/CHANGELOG
CHANGED
@@ -1,4 +1,18 @@
|
|
1
|
-
*
|
1
|
+
*Rails 3.0.0 [beta 2] (April 1st, 2010)*
|
2
|
+
|
3
|
+
* Session store configuration has changed [YK & CL]
|
4
|
+
|
5
|
+
config.session_store :cookie_store, {:key => "..."}
|
6
|
+
config.cookie_secret = "fdsfhisdghfidugnfdlg"
|
7
|
+
|
8
|
+
* railtie_name and engine_name are deprecated. You can now add any object to
|
9
|
+
the configuration object: config.your_plugin = {} [JK]
|
10
|
+
|
11
|
+
* Added config.generators.templates to provide alternative paths for the generators
|
12
|
+
to look for templates [JV]
|
13
|
+
|
14
|
+
|
15
|
+
*Rails 3.0.0 [beta 1] (February 4, 2010)*
|
2
16
|
|
3
17
|
* Added "rake about" as a replacement for script/about [DHH]
|
4
18
|
|
data/README
CHANGED
@@ -29,14 +29,14 @@ link:files/vendor/rails/actionpack/README.html.
|
|
29
29
|
|
30
30
|
1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
|
31
31
|
and your application name. Ex: <tt>rails myapp</tt>
|
32
|
-
2. Change directory into myapp and start the web server: <tt>
|
32
|
+
2. Change directory into myapp and start the web server: <tt>rails server</tt> (run with --help for options)
|
33
33
|
3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
|
34
34
|
4. Follow the guidelines to start developing your application
|
35
35
|
|
36
36
|
|
37
37
|
== Web Servers
|
38
38
|
|
39
|
-
By default, Rails will try to use Mongrel if it's installed when started with
|
39
|
+
By default, Rails will try to use Mongrel if it's installed when started with <tt>rails server</tt>, otherwise
|
40
40
|
Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails with a variety of
|
41
41
|
other web servers.
|
42
42
|
|
@@ -45,7 +45,7 @@ suitable for development and deployment of Rails applications. If you have Ruby
|
|
45
45
|
getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
|
46
46
|
More info at: http://mongrel.rubyforge.org
|
47
47
|
|
48
|
-
Other ruby web servers exist which can run your rails application, however
|
48
|
+
Other ruby web servers exist which can run your rails application, however <tt>rails server</tt> does
|
49
49
|
not search for them or start them. These include {Thin}[http://code.macournoyer.com/thin/], {Ebb}[http://ebb.rubyforge.org/], and Apache with {mod_rails}[http://www.modrails.com/].
|
50
50
|
|
51
51
|
For production use, often a web/proxy server such as {Apache}[http://apache.org], {Nginx}[http://nginx.net/], {LiteSpeed}[http://litespeedtech.com/], {Lighttpd}[http://www.lighttpd.net/] or {IIS}[http://www.iis.net/] is
|
@@ -168,22 +168,22 @@ model. Here you'll have all parts of the application configured, just like it is
|
|
168
168
|
application is running. You can inspect domain models, change values, and save to the
|
169
169
|
database. Starting the script without arguments will launch it in the development environment.
|
170
170
|
|
171
|
-
To start the console, just run <tt>
|
171
|
+
To start the console, just run <tt>rails console</tt> from the application directory.
|
172
172
|
|
173
173
|
Options:
|
174
174
|
|
175
175
|
* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications made to the database.
|
176
176
|
* Passing an environment name as an argument will load the corresponding environment.
|
177
|
-
Example: <tt>
|
177
|
+
Example: <tt>rails console production</tt>.
|
178
178
|
|
179
179
|
More information about irb can be found at link:http://www.rubycentral.com/pickaxe/irb.html
|
180
180
|
|
181
181
|
== dbconsole
|
182
182
|
|
183
|
-
You can go to the command line of your database directly through <tt>
|
183
|
+
You can go to the command line of your database directly through <tt>rails dbconsole</tt>.
|
184
184
|
You would be connected to the database with the credentials defined in database.yml.
|
185
185
|
Starting the script without arguments will connect you to the development database. Passing an
|
186
|
-
argument will connect you to a different database, like <tt>
|
186
|
+
argument will connect you to a different database, like <tt>rails dbconsole production</tt>.
|
187
187
|
Currently works for mysql, postgresql and sqlite.
|
188
188
|
|
189
189
|
== Description of Contents
|
@@ -250,7 +250,7 @@ app/views/layouts
|
|
250
250
|
|
251
251
|
app/helpers
|
252
252
|
Holds view helpers that should be named like weblogs_helper.rb. These are generated
|
253
|
-
for you automatically when using
|
253
|
+
for you automatically when using <tt>rails generate</tt> for controllers. Helpers can be used to
|
254
254
|
wrap functionality for your views into methods.
|
255
255
|
|
256
256
|
config
|
@@ -277,7 +277,7 @@ script
|
|
277
277
|
Helper scripts for automation and generation.
|
278
278
|
|
279
279
|
test
|
280
|
-
Unit and functional tests along with fixtures. When using the
|
280
|
+
Unit and functional tests along with fixtures. When using the <tt>rails generate</tt> scripts, template
|
281
281
|
test files will be generated for you and placed in this directory.
|
282
282
|
|
283
283
|
vendor
|
data/bin/rails
CHANGED
@@ -1,11 +1,30 @@
|
|
1
|
-
|
2
|
-
exec(Dir.getwd + '/script/rails', *ARGV)
|
3
|
-
else
|
4
|
-
railties_path = File.expand_path('../../lib', __FILE__)
|
5
|
-
$:.unshift(railties_path) if File.directory?(railties_path) && !$:.include?(railties_path)
|
1
|
+
require 'rbconfig'
|
6
2
|
|
7
|
-
|
8
|
-
|
3
|
+
module Rails
|
4
|
+
module ScriptRailsLoader
|
5
|
+
RUBY = File.join(*RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) + RbConfig::CONFIG["EXEEXT"]
|
6
|
+
SCRIPT_RAILS = File.join('script', 'rails')
|
9
7
|
|
10
|
-
|
11
|
-
|
8
|
+
def self.exec_script_rails!
|
9
|
+
cwd = Dir.pwd
|
10
|
+
exec RUBY, SCRIPT_RAILS, *ARGV if File.exists?(SCRIPT_RAILS)
|
11
|
+
Dir.chdir("..") do
|
12
|
+
# Recurse in a chdir block: if the search fails we want to be sure
|
13
|
+
# the application is generated in the original working directory.
|
14
|
+
exec_script_rails! unless cwd == Dir.pwd
|
15
|
+
end
|
16
|
+
rescue SystemCallError
|
17
|
+
# could not chdir, no problem just return
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Rails::ScriptRailsLoader.exec_script_rails!
|
23
|
+
|
24
|
+
railties_path = File.expand_path('../../lib', __FILE__)
|
25
|
+
$:.unshift(railties_path) if File.directory?(railties_path) && !$:.include?(railties_path)
|
26
|
+
|
27
|
+
require 'rails/ruby_version_check'
|
28
|
+
Signal.trap("INT") { puts; exit }
|
29
|
+
|
30
|
+
require 'rails/commands/application'
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/guides/rails_guides.rb
CHANGED
@@ -5,40 +5,27 @@ $:.unshift pwd
|
|
5
5
|
require 'rubygems'
|
6
6
|
|
7
7
|
begin
|
8
|
+
# Guides generation in the Rails repo.
|
8
9
|
as_lib = File.join(pwd, "../../activesupport/lib")
|
9
10
|
ap_lib = File.join(pwd, "../../actionpack/lib")
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
require "action_controller"
|
15
|
-
require "action_view"
|
12
|
+
$:.unshift as_lib if File.directory?(as_lib)
|
13
|
+
$:.unshift ap_lib if File.directory?(ap_lib)
|
16
14
|
rescue LoadError
|
17
|
-
|
18
|
-
|
19
|
-
require "action_controller"
|
20
|
-
require "action_view"
|
15
|
+
# Guides generation from gems.
|
16
|
+
gem "actionpack", '>= 3.0'
|
21
17
|
end
|
22
18
|
|
23
19
|
begin
|
24
20
|
gem 'RedCloth', '>= 4.1.1'
|
21
|
+
require 'redcloth'
|
25
22
|
rescue Gem::LoadError
|
26
23
|
$stderr.puts %(Generating Guides requires RedCloth 4.1.1+)
|
27
24
|
exit 1
|
28
25
|
end
|
29
26
|
|
30
|
-
require
|
31
|
-
|
32
|
-
module RailsGuides
|
33
|
-
autoload :Generator, "rails_guides/generator"
|
34
|
-
autoload :Indexer, "rails_guides/indexer"
|
35
|
-
autoload :Helpers, "rails_guides/helpers"
|
36
|
-
autoload :TextileExtensions, "rails_guides/textile_extensions"
|
37
|
-
autoload :Levenshtein, "rails_guides/levenshtein"
|
38
|
-
end
|
39
|
-
|
27
|
+
require "rails_guides/textile_extensions"
|
40
28
|
RedCloth.send(:include, RailsGuides::TextileExtensions)
|
41
29
|
|
42
|
-
|
43
|
-
|
44
|
-
end
|
30
|
+
require "rails_guides/generator"
|
31
|
+
RailsGuides::Generator.new.generate
|
@@ -1,70 +1,95 @@
|
|
1
1
|
require 'set'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
require 'active_support/core_ext/string/output_safety'
|
5
|
+
require 'action_controller'
|
6
|
+
require 'action_view'
|
7
|
+
|
8
|
+
require 'rails_guides/indexer'
|
9
|
+
require 'rails_guides/helpers'
|
10
|
+
require 'rails_guides/levenshtein'
|
8
11
|
|
9
12
|
module RailsGuides
|
10
13
|
class Generator
|
11
|
-
attr_reader :
|
12
|
-
|
13
|
-
def initialize(output = nil)
|
14
|
-
@guides_dir = File.join(File.dirname(__FILE__), '..')
|
15
|
-
|
16
|
-
@output = output || File.join(@guides_dir, "output")
|
14
|
+
attr_reader :guides_dir, :source_dir, :output_dir
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
@view_path = File.join(@guides_dir, "source")
|
16
|
+
def initialize(output=nil)
|
17
|
+
initialize_dirs(output)
|
18
|
+
create_output_dir_if_needed
|
24
19
|
end
|
25
20
|
|
26
21
|
def generate
|
27
|
-
|
22
|
+
generate_guides
|
23
|
+
copy_assets
|
24
|
+
end
|
28
25
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
private
|
27
|
+
def initialize_dirs(output)
|
28
|
+
@guides_dir = File.join(File.dirname(__FILE__), '..')
|
29
|
+
@source_dir = File.join(@guides_dir, "source")
|
30
|
+
@output_dir = output || File.join(@guides_dir, "output")
|
31
|
+
end
|
34
32
|
|
35
|
-
|
36
|
-
|
33
|
+
def create_output_dir_if_needed
|
34
|
+
FileUtils.mkdir_p(output_dir)
|
35
|
+
end
|
36
|
+
|
37
|
+
def generate_guides
|
38
|
+
guides_to_generate.each do |guide|
|
39
|
+
output_file = output_file_for(guide)
|
40
|
+
generate_guide(guide, output_file) if generate?(guide, output_file)
|
37
41
|
end
|
42
|
+
end
|
38
43
|
|
39
|
-
|
40
|
-
|
41
|
-
|
44
|
+
def guides_to_generate
|
45
|
+
guides = Dir.entries(source_dir).grep(/\.textile(?:\.erb)?$/)
|
46
|
+
ENV.key?("ONLY") ? select_only(guides) : guides
|
42
47
|
end
|
43
48
|
|
44
|
-
def
|
45
|
-
|
46
|
-
|
49
|
+
def select_only(guides)
|
50
|
+
prefixes = ENV["ONLY"].split(",").map(&:strip)
|
51
|
+
guides.select do |guide|
|
52
|
+
prefixes.any? {|p| guide.start_with?(p)}
|
53
|
+
end
|
54
|
+
end
|
47
55
|
|
48
|
-
|
56
|
+
def copy_assets
|
57
|
+
FileUtils.cp_r(File.join(guides_dir, 'images'), File.join(output_dir, 'images'))
|
58
|
+
FileUtils.cp_r(File.join(guides_dir, 'files'), File.join(output_dir, 'files'))
|
59
|
+
end
|
49
60
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
61
|
+
def output_file_for(guide)
|
62
|
+
guide.sub(/\.textile(?:\.erb)?$/, '.html')
|
63
|
+
end
|
64
|
+
|
65
|
+
def generate?(source_file, output_file)
|
66
|
+
fin = File.join(source_dir, source_file)
|
67
|
+
fout = File.join(output_dir, output_file)
|
68
|
+
ENV['ALL'] == '1' || !File.exists?(fout) || File.mtime(fout) < File.mtime(fin)
|
69
|
+
end
|
54
70
|
|
71
|
+
def generate_guide(guide, output_file)
|
72
|
+
puts "Generating #{output_file}"
|
73
|
+
File.open(File.join(output_dir, output_file), 'w') do |f|
|
74
|
+
view = ActionView::Base.new(source_dir)
|
75
|
+
view.extend(Helpers)
|
76
|
+
|
55
77
|
if guide =~ /\.textile\.erb$/
|
56
78
|
# Generate the erb pages with textile formatting - e.g. index/authors
|
57
79
|
result = view.render(:layout => 'layout', :file => guide)
|
58
|
-
|
80
|
+
result = textile(result)
|
59
81
|
else
|
60
|
-
body = File.read(File.join(
|
61
|
-
body = set_header_section(body,
|
62
|
-
body = set_index(body,
|
82
|
+
body = File.read(File.join(source_dir, guide))
|
83
|
+
body = set_header_section(body, view)
|
84
|
+
body = set_index(body, view)
|
85
|
+
|
86
|
+
result = view.render(:layout => 'layout', :text => textile(body))
|
63
87
|
|
64
|
-
result = view.render(:layout => 'layout', :text => textile(body).html_safe!)
|
65
|
-
f.write result
|
66
88
|
warn_about_broken_links(result) if ENV.key?("WARN_BROKEN_LINKS")
|
67
89
|
end
|
90
|
+
|
91
|
+
result = insert_edge_badge(result) if ENV.key?('INSERT_EDGE_BADGE')
|
92
|
+
f.write result
|
68
93
|
end
|
69
94
|
end
|
70
95
|
|
@@ -77,8 +102,8 @@ module RailsGuides
|
|
77
102
|
|
78
103
|
header = textile(header)
|
79
104
|
|
80
|
-
view.content_for(:page_title) { page_title.html_safe
|
81
|
-
view.content_for(:header_section) { header.html_safe
|
105
|
+
view.content_for(:page_title) { page_title.html_safe }
|
106
|
+
view.content_for(:header_section) { header.html_safe }
|
82
107
|
new_body
|
83
108
|
end
|
84
109
|
|
@@ -94,22 +119,22 @@ module RailsGuides
|
|
94
119
|
|
95
120
|
# Set index for 2 levels
|
96
121
|
i.level_hash.each do |key, value|
|
97
|
-
link = view.content_tag(:a, :href => key[:id]) { textile(key[:title]) }
|
122
|
+
link = view.content_tag(:a, :href => key[:id]) { textile(key[:title]).html_safe }
|
98
123
|
|
99
124
|
children = value.keys.map do |k|
|
100
|
-
l = view.content_tag(:a, :href => k[:id]) { textile(k[:title]) }
|
101
|
-
view.content_tag(:li, l)
|
125
|
+
l = view.content_tag(:a, :href => k[:id]) { textile(k[:title]).html_safe }
|
126
|
+
view.content_tag(:li, l.html_safe)
|
102
127
|
end
|
103
128
|
|
104
|
-
children_ul = view.content_tag(:ul, children.join(" "))
|
129
|
+
children_ul = view.content_tag(:ul, children.join(" ").html_safe)
|
105
130
|
|
106
|
-
index << view.content_tag(:li, link + children_ul)
|
131
|
+
index << view.content_tag(:li, link.html_safe + children_ul.html_safe)
|
107
132
|
end
|
108
133
|
|
109
134
|
index << '</ol>'
|
110
135
|
index << '</div>'
|
111
136
|
|
112
|
-
view.content_for(:index_section) { index.html_safe
|
137
|
+
view.content_for(:index_section) { index.html_safe }
|
113
138
|
|
114
139
|
i.result
|
115
140
|
end
|
@@ -174,5 +199,9 @@ module RailsGuides
|
|
174
199
|
end
|
175
200
|
end
|
176
201
|
end
|
202
|
+
|
203
|
+
def insert_edge_badge(html)
|
204
|
+
html.sub(/<body[^>]*>/, '\&<img src="images/edge_badge.png" style="position:fixed; right:0px; top:0px; border:none; z-index:100"/>')
|
205
|
+
end
|
177
206
|
end
|
178
207
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module RailsGuides
|
2
2
|
module TextileExtensions
|
3
3
|
def notestuff(body)
|
4
|
-
body.gsub!(/^(IMPORTANT|CAUTION|WARNING|NOTE|INFO)(
|
4
|
+
body.gsub!(/^(IMPORTANT|CAUTION|WARNING|NOTE|INFO)[.:](.*)$/) do |m|
|
5
5
|
css_class = $1.downcase
|
6
6
|
css_class = 'warning' if ['caution', 'important'].include?(css_class)
|
7
7
|
|
@@ -13,9 +13,9 @@ module RailsGuides
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def tip(body)
|
16
|
-
body.gsub!(/^
|
16
|
+
body.gsub!(/^TIP[.:](.*)$/) do |m|
|
17
17
|
result = "<div class='info'><p>"
|
18
|
-
result << $
|
18
|
+
result << $1.strip
|
19
19
|
result << '</p></div>'
|
20
20
|
result
|
21
21
|
end
|
@@ -53,7 +53,7 @@ rake doc:guides
|
|
53
53
|
|
54
54
|
This will put the guides inside +Rails.root/doc/guides+ and you may start surfing straight away by opening +Rails.root/doc/guides/index.html+ in your favourite browser.
|
55
55
|
|
56
|
-
* Lead Contributors: "Rails Documentation Team":
|
56
|
+
* Lead Contributors: "Rails Documentation Team":credits.html
|
57
57
|
* Major contributions from "Xavier Noria":http://advogato.org/person/fxn/diary.html and "Hongli Lai":http://izumi.plan99.net/blog/.
|
58
58
|
* More information:
|
59
59
|
** "Rails Guides hackfest":http://hackfest.rubyonrails.org/guide
|
@@ -47,7 +47,7 @@ After some versions without an upgrade, Rails 2.3 offers some new features for R
|
|
47
47
|
|
48
48
|
h3. Documentation
|
49
49
|
|
50
|
-
The "Ruby on Rails guides":http://guides.rubyonrails.org/ project has published several additional guides for Rails 2.3. In addition, a "separate site":http://
|
50
|
+
The "Ruby on Rails guides":http://guides.rubyonrails.org/ project has published several additional guides for Rails 2.3. In addition, a "separate site":http://edgeguides.rubyonrails.org/ maintains updated copies of the Guides for Edge Rails. Other documentation efforts include a relaunch of the "Rails wiki":http://newwiki.rubyonrails.org/ and early planning for a Rails Book.
|
51
51
|
|
52
52
|
* More Information: "Rails Documentation Projects":http://weblog.rubyonrails.org/2009/1/15/rails-documentation-projects.
|
53
53
|
|
@@ -1,14 +1,14 @@
|
|
1
|
-
h2. Rails 3.0
|
1
|
+
h2. Ruby on Rails 3.0 Release Notes
|
2
2
|
|
3
|
-
Rails 3.0 is ponies and rainbows! It's going to cook you dinner and fold your laundry. You're going to wonder how life was ever possible before
|
3
|
+
Rails 3.0 is ponies and rainbows! It's going to cook you dinner and fold your laundry. You're going to wonder how life was ever possible before it arrived. It's the Best Version of Rails We've Ever Done!
|
4
4
|
|
5
5
|
But seriously now, it's really good stuff. There are all the good ideas brought over from when the Merb team joined the party and brought a focus on framework agnosticism, slimmer and faster internals, and a handful of tasty APIs. If you're coming to Rails 3.0 from Merb 1.x, you should recognize lots. If you're coming from Rails 2.x, you're going to love it too.
|
6
6
|
|
7
7
|
Even if you don't give a hoot about any of our internal cleanups, Rails 3.0 is going to delight. We have a bunch of new features and improved APIs. It's never been a better time to be a Rails developer. Some of the highlights are:
|
8
8
|
|
9
9
|
* Brand new router with an emphasis on RESTful declarations
|
10
|
-
* New Action Mailer API
|
11
|
-
* New Active Record chainable query language built on top of
|
10
|
+
* New Action Mailer API modeled after Action Controller (now without the agonizing pain of sending multipart messages!)
|
11
|
+
* New Active Record chainable query language built on top of relational algebra
|
12
12
|
* Unobtrusive JavaScript helpers with drivers for Prototype, jQuery, and more coming (end of inline JS)
|
13
13
|
* Explicit dependency management with Bundler
|
14
14
|
|
@@ -20,6 +20,18 @@ endprologue.
|
|
20
20
|
|
21
21
|
WARNING: Rails 3.0 is currently in beta. This means that there are probably bugs and that you should "report them":http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/overview if you see them. You also may not want to run the NORAD nuclear launch application off a beta version. But if you're starting development on a new application and you don't mind getting wind in your hair, please do jump on board!
|
22
22
|
|
23
|
+
TIP: To install the Rails 3 prerelease beta using rubygems you have to install all the Rails dependencies first as these will not be installed for you by rubygems:
|
24
|
+
|
25
|
+
<shell>
|
26
|
+
# Use sudo if your setup requires it
|
27
|
+
gem install tzinfo builder i18n memcache-client rack \
|
28
|
+
rake rack-test erubis mail text-format \
|
29
|
+
thor bundler
|
30
|
+
gem install rack-mount -v=0.4
|
31
|
+
gem install rails --pre
|
32
|
+
</shell>
|
33
|
+
|
34
|
+
|
23
35
|
h3. Upgrading to Rails 3
|
24
36
|
|
25
37
|
If you're upgrading an existing application, it's a great idea to have good test coverage before going in. You should also first upgrade to Rails 2.3.5 and make sure your application still runs as expected before attempting to update to Rails 3. Then take heed of the following changes:
|
@@ -39,11 +51,11 @@ h4. script/* replaced by script/rails
|
|
39
51
|
The new <tt>script/rails</tt> replaces all the scripts that used to be in the <tt>script</tt> directory. You do not run <tt>script/rails</tt> directly though, the +rails+ command detects it is being invoked in the root of a Rails application and runs the script for you. Intended usage is:
|
40
52
|
|
41
53
|
<shell>
|
42
|
-
rails console #
|
43
|
-
rails g scaffold post title:string #
|
54
|
+
rails console # instead of script/console
|
55
|
+
rails g scaffold post title:string # instead of script/generate scaffold post title:string
|
44
56
|
</shell>
|
45
57
|
|
46
|
-
Run rails --help for a list of all the options.
|
58
|
+
Run <tt>rails --help</tt> for a list of all the options.
|
47
59
|
|
48
60
|
h4. Dependencies and config.gem
|
49
61
|
|
@@ -65,7 +77,6 @@ Aside from Rails Upgrade tool, if you need more help, there are people on IRC an
|
|
65
77
|
|
66
78
|
More information - "The Path to Rails 3: Approaching the upgrade":http://omgbloglol.com/post/353978923/the-path-to-rails-3-approaching-the-upgrade
|
67
79
|
|
68
|
-
|
69
80
|
h3. Creating a Rails 3.0 application
|
70
81
|
|
71
82
|
The new installing rails sequence (for the beta) is:
|
@@ -80,34 +91,32 @@ h4. Vendoring Gems
|
|
80
91
|
|
81
92
|
Rails now uses a +Gemfile+ in the application root to determine the gems you require for your application to start. This +Gemfile+ is processed by the "Bundler":http://github.com/carlhuda/bundler, which then installs all your dependencies. It can even install all the dependencies locally to your application so that it doesn't depend on the system gems.
|
82
93
|
|
83
|
-
More information: - "
|
84
|
-
|
94
|
+
More information: - "bundler README on Github":http://github.com/carlhuda/bundler
|
85
95
|
|
86
96
|
h4. Living on the Edge
|
87
97
|
|
88
98
|
+Bundler+ and +Gemfile+ makes freezing your Rails application easy as pie with the new dedicated <tt>bundle</tt> command, so <tt>rake freeze</tt> is no longer relevant and has been dropped.
|
89
99
|
|
90
|
-
If you want to bundle straight from the Git repository, you can pass the edge flag:
|
100
|
+
If you want to bundle straight from the Git repository, you can pass the +--edge+ flag:
|
91
101
|
|
92
102
|
<shell>
|
93
103
|
$ rails myapp --edge
|
94
104
|
</shell>
|
95
105
|
|
96
|
-
|
97
|
-
* "Spinning up a new Rails app":http://yehudakatz.com/2009/12/31/spinning-up-a-new-rails-app/
|
98
|
-
* "Rails 3 and Passenger":http://cakebaker.42dh.com/2010/01/17/rails-3-and-passenger/
|
106
|
+
If you have a local checkout of the Rails repository and want to generate an application using that, you can pass the +--dev+ flag:
|
99
107
|
|
108
|
+
<shell>
|
109
|
+
$ ruby /path/to/rails/railties/bin/rails myapp --dev
|
110
|
+
</shell>
|
100
111
|
|
101
112
|
h3. Rails Architectural Changes
|
102
113
|
|
103
114
|
There are six major changes in the architecture of Rails.
|
104
115
|
|
105
|
-
|
106
116
|
h4. Railties Restrung
|
107
117
|
|
108
118
|
Railties was updated to provide a consistent plugin API for the entire Rails framework as well as a total rewrite of generators and the Rails bindings, the result is that developers can now hook into any significant stage of the generators and application framework in a consistent, defined manner.
|
109
119
|
|
110
|
-
|
111
120
|
h4. All Rails core components are decoupled
|
112
121
|
|
113
122
|
With the merge of Merb and Rails, one of the big jobs was to remove the tight coupling between Rails core components. This has now been achieved, and all Rails core components are now using the same API that you can use for developing plugins. This means any plugin you make, or any core component replacement (like DataMapper or Sequel) can access all the functionality that the Rails core components have access to and extend and enhance at will.
|
@@ -145,7 +154,7 @@ More information: - "New Action Mailer API in Rails 3":http://lindsaar.net/2010/
|
|
145
154
|
|
146
155
|
h3. Documentation
|
147
156
|
|
148
|
-
The documentation in the Rails tree is being updated with all the API changes, additionally, the "Rails Edge
|
157
|
+
The documentation in the Rails tree is being updated with all the API changes, additionally, the "Rails Edge Guides":http://edgeguides.rubyonrails.org/ are being updated one by one to reflect the changes in Rails 3.0. The guides at "guides.rubyonrails.org":http://guides.rubyonrails.org/ however will continue to contain only the stable version of Rails (at this point, version 2.3.5, until 3.0 is released).
|
149
158
|
|
150
159
|
More Information: - "Rails Documentation Projects":http://weblog.rubyonrails.org/2009/1/15/rails-documentation-projects.
|
151
160
|
|
@@ -166,7 +175,7 @@ h3. Railties
|
|
166
175
|
|
167
176
|
With the decoupling of the main Rails frameworks, Railties got a huge overhaul so as to make linking up frameworks, engines or plugins as painless and extensible as possible:
|
168
177
|
|
169
|
-
* Each application now has
|
178
|
+
* Each application now has its own name space, application is started with <tt>YourAppName.boot</tt> for example, makes interacting with other applications a lot easier.
|
170
179
|
* Anything under <tt>Rails.root/app</tt> is now added to the load path, so you can make <tt>app/observers/user_observer.rb</tt> and Rails will load it without any modifications.
|
171
180
|
* Rails 3.0 now provides a <tt>Rails.config</tt> object, which provides a central repository of all sorts of Rails wide configuration options.
|
172
181
|
|
@@ -203,7 +212,7 @@ Railties now deprecates:
|
|
203
212
|
More information:
|
204
213
|
* "Discovering Rails 3 generators":http://blog.plataformatec.com.br/2010/01/discovering-rails-3-generators
|
205
214
|
* "Making Generators for Rails 3 with Thor":http://caffeinedd.com/guides/331-making-generators-for-rails-3-with-thor
|
206
|
-
|
215
|
+
* "The Rails Module (in Rails 3)":http://litanyagainstfear.com/blog/2010/02/03/the-rails-module/
|
207
216
|
|
208
217
|
h3. Action Pack
|
209
218
|
|
@@ -224,8 +233,8 @@ More Information: - "Rails Edge Architecture":http://yehudakatz.com/2009/06/11/r
|
|
224
233
|
h4. Action Controller
|
225
234
|
|
226
235
|
* <tt>application_controller.rb</tt> now has <tt>protect_from_forgery</tt> on by default.
|
227
|
-
* The <tt>cookie_verifier_secret</tt> has been moved
|
228
|
-
* The <tt>session_store</tt>
|
236
|
+
* The <tt>cookie_verifier_secret</tt> has been deprecated and now instead it is assigned through <tt>Rails.application.config.cookie_secret</tt> and moved into its own file: <tt>config/initializers/cookie_verification_secret.rb</tt>.
|
237
|
+
* The <tt>session_store</tt> was configured in <tt>ActionController::Base.session</tt>, and that is now moved to <tt>Rails.application.config.session_store</tt>. Defaults are set up in <tt>config/initializers/session_store.rb</tt>.
|
229
238
|
* <tt>cookies.secure</tt> allowing you to set encrypted values in cookies with <tt>cookie.secure[:key] => value</tt>.
|
230
239
|
* <tt>cookies.permanent</tt> allowing you to set permanent values in the cookie hash <tt>cookie.permanent[:key] => value</tt> that raise exceptions on signed values if verification failures.
|
231
240
|
* You can now pass <tt>:notice => 'This is a flash message'</tt> or <tt>:alert => 'Something went wrong'</tt> to the <tt>format</tt> call inside a +respond_to+ block. The <tt>flash[]</tt> hash still works as previously.
|
@@ -251,7 +260,7 @@ Action Dispatch is new in Rails 3.0 and provides a new, cleaner implementation f
|
|
251
260
|
<ruby>
|
252
261
|
# Instead of:
|
253
262
|
|
254
|
-
ActionController::Routing::Routes.draw do
|
263
|
+
ActionController::Routing::Routes.draw do |map|
|
255
264
|
map.resources :posts
|
256
265
|
end
|
257
266
|
|
@@ -313,7 +322,6 @@ Produces:
|
|
313
322
|
* I18n select label on should now be :en.helpers.select instead of :en.support.select.
|
314
323
|
* You no longer need to place a minus sign at the end of a ruby interpolation inside an ERb template to remove the trailing carriage return in the HTML output.
|
315
324
|
* Added +grouped_collection_select+ helper to Action View.
|
316
|
-
* Action View now will raise exceptions if CSS stylesheets and javascript files listed in the +javascript_include_tag+ and +stylesheet_include_tag+ helpers are missing.
|
317
325
|
* +content_for?+ has been added allowing you to check for the existence of content in a view before rendering.
|
318
326
|
|
319
327
|
|
@@ -386,7 +394,7 @@ Active Record received a lot of attention in Rails 3.0, including abstraction in
|
|
386
394
|
|
387
395
|
h4. Query Interface
|
388
396
|
|
389
|
-
Active Record, through the use of Arel, now returns relations on
|
397
|
+
Active Record, through the use of Arel, now returns relations on its core methods. The existing API in Rails 2.3.x is still supported and will not be deprecated until Rails 3.1 and not removed until Rails 3.2, however, the new API provides the following new methods that all return relations allowing them to be chained together:
|
390
398
|
|
391
399
|
* <tt>where</tt> - provides conditions on the relation, what gets returned.
|
392
400
|
* <tt>select</tt> - choose what attributes of the models you wish to have returned from the database.
|
@@ -421,7 +429,7 @@ Additionally, many fixes in the Active Record branch:
|
|
421
429
|
|
422
430
|
* SQLite 2 support has been dropped in favour of SQLite 3.
|
423
431
|
* MySQL support for column order.
|
424
|
-
* PostgreSQL adapter has had
|
432
|
+
* PostgreSQL adapter has had its +TIME ZONE+ support fixed so it no longer inserts incorrect values.
|
425
433
|
* Support multiple schemas in table names for PostgreSQL.
|
426
434
|
* PostgreSQL support for the XML data type column.
|
427
435
|
* +table_name+ is now cached.
|
@@ -435,7 +443,7 @@ As well as the following deprecations:
|
|
435
443
|
* I18n error messages for ActiveRecord should be changed from :en.activerecord.errors.template to <tt>:en.errors.template</tt>.
|
436
444
|
* <tt>model.errors.on</tt> is deprecated in favour of <tt>model.errors[]</tt>
|
437
445
|
* validates_presence_of => validates... :presence => true
|
438
|
-
* <tt>ActiveRecord::Base.colorize_logging</tt> and <tt>config.active_record.colorize_logging</tt> are deprecated in favour of <tt>Rails::
|
446
|
+
* <tt>ActiveRecord::Base.colorize_logging</tt> and <tt>config.active_record.colorize_logging</tt> are deprecated in favour of <tt>Rails::LogSubscriber.colorize_logging</tt> or <tt>config.colorize_logging</tt>
|
439
447
|
|
440
448
|
NOTE: While an implementation of State Machine has been in Active Record edge for some months now, it has been removed from the Rails 3.0 release.
|
441
449
|
|
@@ -461,7 +469,7 @@ Active Resource was also extracted out to Active Model allowing you to use Activ
|
|
461
469
|
* Fix <tt>ActiveResource::ConnectionError#to_s</tt> when +@response+ does not respond to #code or #message, handles Ruby 1.9 compat.
|
462
470
|
* Add support for errors in JSON format.
|
463
471
|
* Ensure <tt>load</tt> works with numeric arrays.
|
464
|
-
*
|
472
|
+
* Recognizes a 410 response from remote resource as the resource has been deleted.
|
465
473
|
* Add ability to set SSL options on Active Resource connections.
|
466
474
|
* Setting connection timeout also affects +Net::HTTP+ <tt>open_timeout</tt>.
|
467
475
|
|
@@ -478,7 +486,7 @@ A large effort was made in Active Support to make it cherry pickable, that is, y
|
|
478
486
|
These are the main changes in Active Support:
|
479
487
|
|
480
488
|
* Large clean up of the library removing unused methods throughout.
|
481
|
-
* Active Support no longer provides vendored versions of "TZInfo":http://tzinfo.rubyforge.org/, "Memcache Client":http://deveiate.org/projects/RMemCache/ and "Builder":http://builder.rubyforge.org/, these are all included as dependencies and installed via the <tt>
|
489
|
+
* Active Support no longer provides vendored versions of "TZInfo":http://tzinfo.rubyforge.org/, "Memcache Client":http://deveiate.org/projects/RMemCache/ and "Builder":http://builder.rubyforge.org/, these are all included as dependencies and installed via the <tt>bundle install</tt> command.
|
482
490
|
* Safe buffers are implemented in <tt>ActiveSupport::SafeBuffer</tt>.
|
483
491
|
* Added <tt>Array.uniq_by</tt> and <tt>Array.uniq_by!</tt>.
|
484
492
|
* Fixed bug on +TimeZone.seconds_to_utc_offset+ returning wrong value.
|
@@ -501,7 +509,7 @@ These are the main changes in Active Support:
|
|
501
509
|
* <tt>String#to_time</tt> and <tt>String#to_datetime</tt> handle fractional seconds.
|
502
510
|
* Added support to new callbacks for around filter object that respond to <tt>:before</tt> and <tt>:after</tt> used in before and after callbacks.
|
503
511
|
* The <tt>ActiveSupport::OrderedHash#to_a</tt> method returns an ordered set of arrays. Matches Ruby 1.9's <tt>Hash#to_a</tt>.
|
504
|
-
* <tt>MissingSourceFile</tt> exists as a constant but it is now just equals to <tt>LoadError</tt
|
512
|
+
* <tt>MissingSourceFile</tt> exists as a constant but it is now just equals to <tt>LoadError</tt>.
|
505
513
|
* Added <tt>Class#class_attribute</tt>, to be able to declare a class-level attribute whose value is inheritable and overwritable by subclasses.
|
506
514
|
* Finally removed +DeprecatedCallbacks+ in <tt>ActiveRecord::Associations</tt>.
|
507
515
|
|
@@ -520,10 +528,10 @@ The security patch for REXML remains in Active Support because early patchlevels
|
|
520
528
|
|
521
529
|
The following methods have been removed because they are no longer used in the framework:
|
522
530
|
|
523
|
-
*
|
524
|
-
* <tt>
|
525
|
-
* <tt>
|
526
|
-
* <tt>Regexp.unoptionalize</tt>, <tt>Regexp.optionalize</tt>, <tt>Regexp#number_of_captures</tt>
|
531
|
+
* +Kernel#daemonize+
|
532
|
+
* <tt>Object#remove_subclasses_of</tt> <tt>Object#extend_with_included_modules_from</tt>, <tt>Object#extended_by</tt>
|
533
|
+
* <tt>Class#remove_class</tt>
|
534
|
+
* <tt>Regexp#number_of_captures</tt>, <tt>Regexp.unoptionalize</tt>, <tt>Regexp.optionalize</tt>, <tt>Regexp#number_of_captures</tt>
|
527
535
|
|
528
536
|
|
529
537
|
h3. Action Mailer
|
@@ -532,11 +540,11 @@ Action Mailer has been given a new API with TMail being replaced out with the ne
|
|
532
540
|
|
533
541
|
* All mailers are now in <tt>app/mailers</tt> by default.
|
534
542
|
* Can now send email using new API with three methods: +attachments+, +headers+ and +mail+.
|
535
|
-
*
|
543
|
+
* Action Mailer emailing methods now return <tt>Mail::Message</tt> objects, which can then be sent the +deliver+ message to send itself.
|
536
544
|
* All delivery methods are now abstracted out to the Mail gem.
|
537
545
|
* The mail delivery method can accept a hash of all valid mail header fields with their value pair.
|
538
|
-
* The mail delivery method acts in a similar way to Action Controller's respond_to
|
539
|
-
* You can pass a proc to the <tt>format.mime_type</tt> calls within the mail block and explicitly render specific types of text, or add layouts or different templates. The +render+ call inside the proc is from Abstract Controller
|
546
|
+
* The +mail+ delivery method acts in a similar way to Action Controller's +respond_to+, and you can explicitly or implicitly render templates. Action Mailer will turn the email into a multipart email as needed.
|
547
|
+
* You can pass a proc to the <tt>format.mime_type</tt> calls within the mail block and explicitly render specific types of text, or add layouts or different templates. The +render+ call inside the proc is from Abstract Controller and supports the same options.
|
540
548
|
* What were mailer unit tests have been moved to functional tests.
|
541
549
|
|
542
550
|
Deprecations:
|
@@ -545,7 +553,7 @@ Deprecations:
|
|
545
553
|
* Mailer dynamic <tt>create_method_name</tt> and <tt>deliver_method_name</tt> are deprecated, just call <tt>method_name</tt> which now returns a <tt>Mail::Message</tt> object.
|
546
554
|
* <tt>ActionMailer.deliver(message)</tt> is deprecated, just call <tt>message.deliver</tt>.
|
547
555
|
* <tt>template_root</tt> is deprecated, pass options to a render call inside a proc from the <tt>format.mime_type</tt> method inside the <tt>mail</tt> generation block
|
548
|
-
* The body method to define instance variables is deprecated (<tt>body {:ivar => value}</tt>), just declare instance variables in the method directly and they will be available in the view.
|
556
|
+
* The +body+ method to define instance variables is deprecated (<tt>body {:ivar => value}</tt>), just declare instance variables in the method directly and they will be available in the view.
|
549
557
|
* Mailers being in <tt>app/models</tt> is deprecated, use <tt>app/mailers</tt> instead.
|
550
558
|
|
551
559
|
More Information:
|
@@ -557,4 +565,4 @@ h3. Credits
|
|
557
565
|
|
558
566
|
See the "full list of contributors to Rails":http://contributors.rubyonrails.org/ for the many people who spent many hours making Rails 3. Kudos to all of them.
|
559
567
|
|
560
|
-
Rails 3.0 Release Notes were compiled by "Mikel Lindsaar":http://lindsaar.net.
|
568
|
+
Rails 3.0 Release Notes were compiled by "Mikel Lindsaar":http://lindsaar.net.
|