aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG4
-rw-r--r--railties/lib/rails/application.rb18
-rw-r--r--railties/lib/rails/configuration.rb4
-rw-r--r--railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb4
-rw-r--r--railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb1
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config.ru5
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/application.rb7
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/initializers/new_rails_defaults.rb19
-rw-r--r--railties/lib/rails/generators/rails/app/templates/test/test_helper.rb25
-rw-r--r--railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb4
10 files changed, 23 insertions, 68 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 0bc1ea32bc..fc9277bd28 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,9 @@
*Edge*
+* Removed config/initializers/new_rails_defaults.rb as all frameworks now follow the settings from it [DHH]
+
+* Set config.time_zone to UTC by default [DHH]
+
* Added default .gitignore (this is just recognizing Git market share, don't throw a hissy if you use another SCM) [DHH]
* Added cookies.permanent, cookies.signed, and cookies.permanent.signed accessor for common cookie actions [DHH]. Examples:
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index 5401251397..3fb4b723ab 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -207,18 +207,16 @@ module Rails
# Sets the default value for Time.zone
# If assigned value cannot be matched to a TimeZone, an exception will be raised.
initializer :initialize_time_zone do
- if config.time_zone
- require 'active_support/core_ext/time/zones'
- zone_default = Time.__send__(:get_zone, config.time_zone)
-
- unless zone_default
- raise \
- 'Value assigned to config.time_zone not recognized.' +
- 'Run "rake -D time" for a list of tasks for finding appropriate time zone names.'
- end
+ require 'active_support/core_ext/time/zones'
+ zone_default = Time.__send__(:get_zone, config.time_zone)
- Time.zone_default = zone_default
+ unless zone_default
+ raise \
+ 'Value assigned to config.time_zone not recognized.' +
+ 'Run "rake -D time" for a list of tasks for finding appropriate time zone names.'
end
+
+ Time.zone_default = zone_default
end
# Set the i18n configuration from config.i18n but special-case for the load_path which should be
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb
index f0a0d5e55e..7c1d549c9a 100644
--- a/railties/lib/rails/configuration.rb
+++ b/railties/lib/rails/configuration.rb
@@ -230,6 +230,10 @@ module Rails
def log_level
@log_level ||= RAILS_ENV == 'production' ? :info : :debug
end
+
+ def time_zone
+ @time_zone ||= "UTC"
+ end
def i18n
@i18n ||= begin
diff --git a/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb b/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb
index 9889b52893..2cdf4eae54 100644
--- a/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb
+++ b/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb
@@ -1,8 +1,4 @@
-# Filters added to this controller apply to all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
-
class ApplicationController < ActionController::Base
- helper :all
protect_from_forgery
filter_parameter_logging :password
end
diff --git a/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb b/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb
index 22a7940eb2..de6be7945c 100644
--- a/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb
+++ b/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb
@@ -1,3 +1,2 @@
-# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
diff --git a/railties/lib/rails/generators/rails/app/templates/config.ru b/railties/lib/rails/generators/rails/app/templates/config.ru
index acb8435446..2ab821e38d 100644
--- a/railties/lib/rails/generators/rails/app/templates/config.ru
+++ b/railties/lib/rails/generators/rails/app/templates/config.ru
@@ -1,5 +1,4 @@
-# Require your environment file to bootstrap Rails
-require ::File.expand_path('../config/environment', __FILE__)
+# This file is used by Rack-based servers to start the application.
-# Dispatch the request
+require ::File.expand_path('../config/environment', __FILE__)
run <%= app_const %>.instance
diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb
index 4097f766a6..dce5b55d86 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/application.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb
@@ -17,15 +17,14 @@ module <%= app_name.classify %>
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
- # Run "rake -D time" for a list of tasks for finding time zone names.
- config.time_zone = 'UTC'
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
# config.i18n.default_locale = :de
- # Configure generators values. Many other options are available, be sure to
- # check the documentation.
+ # Configure generators values. Many other options are available, be sure to check the documentation.
# config.generators do |g|
# g.orm :active_record
# g.template_engine :erb
diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_rails_defaults.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_rails_defaults.rb
deleted file mode 100644
index 8ec3186c84..0000000000
--- a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_rails_defaults.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# These settings change the behavior of Rails 2 apps and will be defaults
-# for Rails 3. You can remove this initializer when Rails 3 is released.
-
-if defined?(ActiveRecord)
- # Include Active Record class name as root for JSON serialized output.
- ActiveRecord::Base.include_root_in_json = true
-
- # Store the full class name (including module namespace) in STI type column.
- ActiveRecord::Base.store_full_sti_class = true
-end
-
-# Use ISO 8601 format for JSON serialized times and dates.
-ActiveSupport.use_standard_json_time_format = true
-
-# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
-# if you're including raw json in an HTML page.
-ActiveSupport.escape_html_entities_in_json = false \ No newline at end of file
diff --git a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb b/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb
index a16f587d8b..45b551fc7d 100644
--- a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb
+++ b/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb
@@ -3,31 +3,6 @@ require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'rails/test_help'
class ActiveSupport::TestCase
- # Transactional fixtures accelerate your tests by wrapping each test method
- # in a transaction that's rolled back on completion. This ensures that the
- # test database remains unchanged so your fixtures don't have to be reloaded
- # between every test method. Fewer database queries means faster tests.
- #
- # Read Mike Clark's excellent walkthrough at
- # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
- #
- # Every Active Record database supports transactions except MyISAM tables
- # in MySQL. Turn off transactional fixtures in this case; however, if you
- # don't care one way or the other, switching from MyISAM to InnoDB tables
- # is recommended.
- #
- # The only drawback to using transactional fixtures is when you actually
- # need to test transactions. Since your test is bracketed by a transaction,
- # any transactions started in your code will be automatically rolled back.
- self.use_transactional_fixtures = true
-
- # Instantiated fixtures are slow, but give you @david where otherwise you
- # would need people(:david). If you don't want to migrate your existing
- # test cases which use the @david style and don't mind the speed hit (each
- # instantiated fixtures translates to a database query per test method),
- # then set this back to true.
- self.use_instantiated_fixtures = false
-
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
index e4bf4035da..9380aa49b6 100644
--- a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
+++ b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
@@ -16,7 +16,7 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase
test "should create <%= file_name %>" do
assert_difference('<%= class_name %>.count') do
- post :create, :<%= file_name %> => { }
+ post :create, :<%= file_name %> => <%= table_name %>(:one).attributes
end
assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
@@ -33,7 +33,7 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase
end
test "should update <%= file_name %>" do
- put :update, :id => <%= table_name %>(:one).to_param, :<%= file_name %> => { }
+ put :update, :id => <%= table_name %>(:one).to_param, :<%= file_name %> => <%= table_name %>(:one).attributes
assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
end