aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/application/finisher.rb7
-rw-r--r--railties/lib/rails/commands/console.rb2
-rw-r--r--railties/lib/rails/generators/generated_attribute.rb1
-rw-r--r--railties/lib/rails/generators/rails/app/templates/Gemfile3
4 files changed, 11 insertions, 2 deletions
diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb
index 855467227b..8fd2aa0bce 100644
--- a/railties/lib/rails/application/finisher.rb
+++ b/railties/lib/rails/application/finisher.rb
@@ -46,6 +46,13 @@ module Rails
ActiveSupport.run_load_hooks(:after_initialize, self)
end
+ # Force routes to be loaded just at the end and add it to to_prepare callbacks
+ initializer :set_routes_reloader do |app|
+ reloader = lambda { app.routes_reloader.execute_if_updated }
+ reloader.call
+ ActionDispatch::Callbacks.to_prepare(&reloader)
+ end
+
# Disable dependency loading during request cycle
initializer :disable_dependency_loading do
if config.cache_classes && !config.dependency_loading
diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb
index 834a120c01..de2f190ad5 100644
--- a/railties/lib/rails/commands/console.rb
+++ b/railties/lib/rails/commands/console.rb
@@ -48,5 +48,5 @@ end
# Has to set the RAILS_ENV before config/application is required
if ARGV.first && !ARGV.first.index("-") && env = ARGV.pop # has to pop the env ARGV so IRB doesn't freak
- ENV['RAILS_ENV'] = %w(production development test).find { |e| e.index(env) } || env
+ ENV['RAILS_ENV'] = %w(production development test).detect {|e| e =~ /^#{env}/} || env
end
diff --git a/railties/lib/rails/generators/generated_attribute.rb b/railties/lib/rails/generators/generated_attribute.rb
index 3b9fff2f4a..64273e4ca4 100644
--- a/railties/lib/rails/generators/generated_attribute.rb
+++ b/railties/lib/rails/generators/generated_attribute.rb
@@ -6,6 +6,7 @@ module Rails
attr_accessor :name, :type
def initialize(name, type)
+ raise Thor::Error, "Missing type for attribute '#{name}'.\nExample: '#{name}:string' where string is the type." if type.blank?
@name, @type = name, type.to_sym
end
diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile
index 3a8a63a2f9..d553c09484 100644
--- a/railties/lib/rails/generators/rails/app/templates/Gemfile
+++ b/railties/lib/rails/generators/rails/app/templates/Gemfile
@@ -23,8 +23,9 @@ gem '<%= gem_for_database %>'<% if require_for_database %>, :require => '<%= req
# Deploy with Capistrano
# gem 'capistrano'
-# To use debugger
+# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
+# gem 'ruby-debug19'
# Bundle the extra gems:
# gem 'bj'