railties 3.0.0.rc → 3.0.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +80 -75
- data/README.rdoc +1 -1
- data/guides/assets/stylesheets/main.css +14 -14
- data/guides/rails_guides.rb +20 -1
- data/guides/rails_guides/generator.rb +7 -7
- data/guides/source/2_3_release_notes.textile +5 -5
- data/guides/source/3_0_release_notes.textile +4 -3
- data/guides/source/action_controller_overview.textile +32 -17
- data/guides/source/action_view_overview.textile +44 -44
- data/guides/source/active_record_basics.textile +2 -2
- data/guides/source/active_record_querying.textile +7 -7
- data/guides/source/active_record_validations_callbacks.textile +20 -20
- data/guides/source/active_support_core_extensions.textile +370 -198
- data/guides/source/ajax_on_rails.textile +17 -17
- data/guides/source/api_documentation_guidelines.textile +3 -3
- data/guides/source/association_basics.textile +2 -2
- data/guides/source/caching_with_rails.textile +5 -5
- data/guides/source/command_line.textile +8 -8
- data/guides/source/configuring.textile +6 -6
- data/guides/source/contributing_to_rails.textile +14 -11
- data/guides/source/debugging_rails_applications.textile +8 -6
- data/guides/source/form_helpers.textile +1 -1
- data/guides/source/generators.textile +34 -30
- data/guides/source/getting_started.textile +13 -13
- data/guides/source/i18n.textile +12 -1
- data/guides/source/index.html.erb +4 -0
- data/guides/source/initialization.textile +67 -72
- data/guides/source/layout.html.erb +1 -0
- data/guides/source/layouts_and_rendering.textile +9 -9
- data/guides/source/nested_model_forms.textile +7 -7
- data/guides/source/plugins.textile +1 -1
- data/guides/source/rails_application_templates.textile +2 -2
- data/guides/source/routing.textile +27 -5
- data/guides/source/security.textile +6 -6
- data/guides/w3c_validator.rb +9 -9
- data/lib/rails/application.rb +1 -0
- data/lib/rails/application/configuration.rb +1 -1
- data/lib/rails/code_statistics.rb +4 -4
- data/lib/rails/commands.rb +1 -1
- data/lib/rails/commands/dbconsole.rb +1 -1
- data/lib/rails/commands/plugin.rb +1 -1
- data/lib/rails/commands/runner.rb +1 -1
- data/lib/rails/deprecation.rb +31 -52
- data/lib/rails/engine.rb +1 -1
- data/lib/rails/engine/configuration.rb +28 -1
- data/lib/rails/generators.rb +2 -2
- data/lib/rails/generators/actions.rb +3 -3
- data/lib/rails/generators/active_model.rb +3 -3
- data/lib/rails/generators/base.rb +1 -1
- data/lib/rails/generators/rails/app/app_generator.rb +9 -3
- data/lib/rails/generators/rails/app/templates/Gemfile +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +4 -13
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +4 -0
- data/lib/rails/generators/rails/app/templates/config/routes.rb +4 -4
- data/lib/rails/generators/rails/app/templates/public/index.html +0 -23
- data/lib/rails/generators/rails/app/templates/public/javascripts/effects.js +1 -1
- data/lib/rails/generators/rails/generator/USAGE +3 -2
- data/lib/rails/generators/rails/migration/USAGE +4 -4
- data/lib/rails/generators/rails/plugin/USAGE +1 -1
- data/lib/rails/generators/rails/resource/resource_generator.rb +2 -2
- data/lib/rails/generators/test_case.rb +1 -1
- data/lib/rails/info_controller.rb +1 -1
- data/lib/rails/plugin.rb +1 -1
- data/lib/rails/rack/log_tailer.rb +2 -5
- data/lib/rails/railtie.rb +22 -22
- data/lib/rails/script_rails_loader.rb +2 -2
- data/lib/rails/tasks/documentation.rake +5 -5
- data/lib/rails/tasks/framework.rake +1 -1
- data/lib/rails/tasks/routes.rake +23 -9
- data/lib/rails/test_unit/testing.rake +3 -2
- data/lib/rails/version.rb +1 -1
- metadata +10 -10
@@ -16,9 +16,9 @@ module Rails
|
|
16
16
|
|
17
17
|
def add_resource_route
|
18
18
|
return if options[:actions].present?
|
19
|
-
route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
|
19
|
+
route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
|
20
20
|
route_config << "resources :#{file_name.pluralize}"
|
21
|
-
route_config << " end" * class_path.size
|
21
|
+
route_config << " end" * class_path.size
|
22
22
|
route route_config
|
23
23
|
end
|
24
24
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Rails::InfoController < ActionController::Base
|
2
2
|
def properties
|
3
|
-
if consider_all_requests_local? ||
|
3
|
+
if consider_all_requests_local? || request.local?
|
4
4
|
render :inline => Rails::Info.to_html
|
5
5
|
else
|
6
6
|
render :text => '<p>For security purposes, this information is only available to local requests.</p>', :status => :forbidden
|
data/lib/rails/plugin.rb
CHANGED
@@ -16,7 +16,7 @@ module Rails
|
|
16
16
|
# Besides this conceptual difference, the only difference between Rails::Engine and
|
17
17
|
# Rails::Plugin is that plugins automatically load the file "init.rb" at the plugin
|
18
18
|
# root during the boot process.
|
19
|
-
#
|
19
|
+
#
|
20
20
|
class Plugin < Engine
|
21
21
|
def self.inherited(base)
|
22
22
|
raise "You cannot inherit from Rails::Plugin"
|
@@ -6,7 +6,6 @@ module Rails
|
|
6
6
|
|
7
7
|
path = Pathname.new(log || "#{File.expand_path(Rails.root)}/log/#{Rails.env}.log").cleanpath
|
8
8
|
@cursor = ::File.size(path)
|
9
|
-
@last_checked = Time.now.to_f
|
10
9
|
|
11
10
|
@file = ::File.open(path, 'r')
|
12
11
|
end
|
@@ -20,11 +19,9 @@ module Rails
|
|
20
19
|
def tail!
|
21
20
|
@file.seek @cursor
|
22
21
|
|
23
|
-
|
24
|
-
if mod > @last_checked
|
22
|
+
if !@file.eof?
|
25
23
|
contents = @file.read
|
26
|
-
@
|
27
|
-
@cursor += contents.size
|
24
|
+
@cursor = @file.tell
|
28
25
|
$stdout.print contents
|
29
26
|
end
|
30
27
|
end
|
data/lib/rails/railtie.rb
CHANGED
@@ -6,53 +6,53 @@ require 'active_support/deprecation'
|
|
6
6
|
module Rails
|
7
7
|
# Railtie is the core of the Rails Framework and provides several hooks to extend
|
8
8
|
# Rails and/or modify the initialization process.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Every major component of Rails (Action Mailer, Action Controller,
|
11
11
|
# Action View, Active Record and Active Resource) are all Railties, so each of
|
12
12
|
# them is responsible to set their own initialization. This makes, for example,
|
13
13
|
# Rails absent of any Active Record hook, allowing any other ORM framework to hook in.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# Developing a Rails extension does _not_ require any implementation of
|
16
16
|
# Railtie, but if you need to interact with the Rails framework during
|
17
17
|
# or after boot, then Railtie is what you need to do that interaction.
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# For example, the following would need you to implement Railtie in your
|
20
20
|
# plugin:
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# * creating initializers
|
23
23
|
# * configuring a Rails framework or the Application, like setting a generator
|
24
24
|
# * adding Rails config.* keys to the environment
|
25
25
|
# * setting up a subscriber to the Rails +ActiveSupport::Notifications+
|
26
26
|
# * adding rake tasks into rails
|
27
|
-
#
|
27
|
+
#
|
28
28
|
# == Creating your Railtie
|
29
29
|
#
|
30
30
|
# Implementing Railtie in your Rails extension is done by creating a class
|
31
31
|
# Railtie that has your extension name and making sure that this gets loaded
|
32
32
|
# during boot time of the Rails stack.
|
33
|
-
#
|
33
|
+
#
|
34
34
|
# You can do this however you wish, but here is an example if you want to provide
|
35
35
|
# it for a gem that can be used with or without Rails:
|
36
|
-
#
|
36
|
+
#
|
37
37
|
# * Create a file (say, lib/my_gem/railtie.rb) which contains class Railtie inheriting from
|
38
38
|
# Rails::Railtie and is namespaced to your gem:
|
39
39
|
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
40
|
+
# # lib/my_gem/railtie.rb
|
41
|
+
# module MyGem
|
42
|
+
# class Railtie < Rails::Railtie
|
43
|
+
# end
|
43
44
|
# end
|
44
|
-
#
|
45
|
-
#
|
45
|
+
#
|
46
46
|
# * Require your own gem as well as rails in this file:
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
47
|
+
#
|
48
|
+
# # lib/my_gem/railtie.rb
|
49
|
+
# require 'my_gem'
|
50
|
+
# require 'rails'
|
51
|
+
#
|
52
|
+
# module MyGem
|
53
|
+
# class Railtie < Rails::Railtie
|
54
|
+
# end
|
54
55
|
# end
|
55
|
-
# end
|
56
56
|
#
|
57
57
|
# == Initializers
|
58
58
|
#
|
@@ -65,7 +65,7 @@ module Rails
|
|
65
65
|
# end
|
66
66
|
# end
|
67
67
|
#
|
68
|
-
# If specified, the block can also receive the application object, in case you
|
68
|
+
# If specified, the block can also receive the application object, in case you
|
69
69
|
# need to access some application specific configuration, like middleware:
|
70
70
|
#
|
71
71
|
# class MyRailtie < Rails::Railtie
|
@@ -121,7 +121,7 @@ module Rails
|
|
121
121
|
# described here can be used in all three.
|
122
122
|
#
|
123
123
|
# Be sure to look at the documentation of those specific classes for more information.
|
124
|
-
#
|
124
|
+
#
|
125
125
|
class Railtie
|
126
126
|
autoload :Configurable, "rails/railtie/configurable"
|
127
127
|
autoload :Configuration, "rails/railtie/configuration"
|
@@ -17,11 +17,11 @@ module Rails
|
|
17
17
|
rescue SystemCallError
|
18
18
|
# could not chdir, no problem just return
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def self.in_rails_application?
|
22
22
|
File.exists?(SCRIPT_RAILS)
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def self.in_rails_application_subdirectory?(path = Pathname.new(Dir.pwd))
|
26
26
|
File.exists?(File.join(path, SCRIPT_RAILS)) || !path.root? && in_rails_application_subdirectory?(path.parent)
|
27
27
|
end
|
@@ -4,15 +4,15 @@ require 'rake/rdoctask'
|
|
4
4
|
class RDocTaskWithoutDescriptions < Rake::RDocTask
|
5
5
|
def define
|
6
6
|
task rdoc_task_name
|
7
|
-
|
7
|
+
|
8
8
|
task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
|
9
|
-
|
9
|
+
|
10
10
|
task clobber_task_name do
|
11
11
|
rm_r rdoc_dir rescue nil
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
task :clobber => [clobber_task_name]
|
15
|
-
|
15
|
+
|
16
16
|
directory @rdoc_dir
|
17
17
|
task rdoc_task_name => [rdoc_target]
|
18
18
|
file rdoc_target => @rdoc_files + [Rake.application.rakefile] do
|
@@ -55,7 +55,7 @@ namespace :doc do
|
|
55
55
|
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
56
56
|
rdoc.title = "Rails Framework Documentation"
|
57
57
|
rdoc.options << '--line-numbers' << '--inline-source'
|
58
|
-
rdoc.rdoc_files.include('README
|
58
|
+
rdoc.rdoc_files.include('README')
|
59
59
|
|
60
60
|
gem_path('actionmailer') do |actionmailer|
|
61
61
|
%w(README.rdoc CHANGELOG MIT-LICENSE lib/action_mailer/base.rb).each do |file|
|
data/lib/rails/tasks/routes.rake
CHANGED
@@ -1,21 +1,35 @@
|
|
1
1
|
desc 'Print out all defined routes in match order, with names. Target specific controller with CONTROLLER=x.'
|
2
2
|
task :routes => :environment do
|
3
3
|
Rails.application.reload_routes!
|
4
|
-
|
4
|
+
|
5
|
+
all_routes = Rails.application.routes.routes
|
6
|
+
named_routes = Rails.application.routes.named_routes.routes
|
7
|
+
|
8
|
+
if ENV['CONTROLLER']
|
9
|
+
all_routes = all_routes.select{ |route| route.defaults[:controller] == ENV['CONTROLLER'] }
|
10
|
+
end
|
11
|
+
|
5
12
|
routes = all_routes.collect do |route|
|
6
13
|
# TODO: The :index method is deprecated in 1.9 in favor of :key
|
7
14
|
# but we don't have :key in 1.8.7. We can remove this check when
|
8
15
|
# stop supporting 1.8.x
|
9
|
-
|
10
|
-
name =
|
11
|
-
|
16
|
+
key = Hash.method_defined?('key') ? 'key' : 'index'
|
17
|
+
name = named_routes.send(key, route).to_s
|
18
|
+
|
19
|
+
reqs = route.requirements.dup
|
20
|
+
reqs[:to] = route.app unless route.app.is_a?(ActionDispatch::Routing::RouteSet::Dispatcher)
|
21
|
+
reqs = reqs.empty? ? "" : reqs.inspect
|
22
|
+
|
12
23
|
{:name => name, :verb => route.verb.to_s, :path => route.path, :reqs => reqs}
|
13
24
|
end
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
25
|
+
|
26
|
+
routes.reject! { |r| r[:path] == "/rails/info/properties" } # Skip the route if it's internal info route
|
27
|
+
|
28
|
+
name_width = routes.map{ |r| r[:name] }.map(&:length).max
|
29
|
+
verb_width = routes.map{ |r| r[:verb] }.map(&:length).max
|
30
|
+
path_width = routes.map{ |r| r[:path] }.map(&:length).max
|
31
|
+
|
18
32
|
routes.each do |r|
|
19
33
|
puts "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:path].ljust(path_width)} #{r[:reqs]}"
|
20
34
|
end
|
21
|
-
end
|
35
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rbconfig'
|
1
2
|
require 'rake/testtask'
|
2
3
|
|
3
4
|
# Monkey-patch to silence the description from Rake::TestTask to cut down on rake -T noise
|
@@ -62,7 +63,7 @@ end
|
|
62
63
|
module Kernel
|
63
64
|
def silence_stderr
|
64
65
|
old_stderr = STDERR.dup
|
65
|
-
STDERR.reopen(
|
66
|
+
STDERR.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
|
66
67
|
STDERR.sync = true
|
67
68
|
yield
|
68
69
|
ensure
|
@@ -70,7 +71,7 @@ module Kernel
|
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
73
|
-
desc 'Runs test:
|
74
|
+
desc 'Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:profile, test:plugins)'
|
74
75
|
task :test do
|
75
76
|
errors = %w(test:units test:functionals test:integration).collect do |task|
|
76
77
|
begin
|
data/lib/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 977940607
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 3.0.0.
|
10
|
+
- rc2
|
11
|
+
version: 3.0.0.rc2
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- David Heinemeier Hansson
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-08-23 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -59,13 +59,13 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - "="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
hash:
|
62
|
+
hash: 977940607
|
63
63
|
segments:
|
64
64
|
- 3
|
65
65
|
- 0
|
66
66
|
- 0
|
67
|
-
-
|
68
|
-
version: 3.0.0.
|
67
|
+
- rc2
|
68
|
+
version: 3.0.0.rc2
|
69
69
|
type: :runtime
|
70
70
|
version_requirements: *id003
|
71
71
|
- !ruby/object:Gem::Dependency
|
@@ -76,13 +76,13 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - "="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
hash:
|
79
|
+
hash: 977940607
|
80
80
|
segments:
|
81
81
|
- 3
|
82
82
|
- 0
|
83
83
|
- 0
|
84
|
-
-
|
85
|
-
version: 3.0.0.
|
84
|
+
- rc2
|
85
|
+
version: 3.0.0.rc2
|
86
86
|
type: :runtime
|
87
87
|
version_requirements: *id004
|
88
88
|
description: "Rails internals: application bootup, plugins, generators, and rake tasks."
|