Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10570: change_application_to_application_controller2.diff

File change_application_to_application_controller2.diff, 7.7 kB (added by jaycfields, 7 months ago)
  • activesupport/test/dependencies_test.rb

    old new  
    446446 
    447447  def test_application_should_special_case_application_controller 
    448448    with_loading 'autoloading_fixtures' do 
    449       require_dependency 'application' 
    450449      assert_equal 10, ApplicationController 
    451450      assert Dependencies.autoloaded?(:ApplicationController) 
    452451    end 
  • activesupport/test/autoloading_fixtures/application.rb

    old new  
  • activesupport/test/autoloading_fixtures/application_controller.rb

    old new  
  • activesupport/lib/active_support/dependencies.rb

    old new  
    142142      next if nesting.blank? 
    143143       
    144144      [ 
    145         nesting.camelize, 
    146         # Special case: application.rb might define ApplicationControlller. 
    147         ('ApplicationController' if nesting == 'application') 
     145        nesting.camelize 
    148146      ] 
    149147    end.flatten.compact.uniq 
    150148  end 
  • actionpack/lib/action_controller/dispatcher.rb

    old new  
    137137    end 
    138138 
    139139    def prepare_application(force = false) 
    140       begin 
    141         require_dependency 'application' unless defined?(::ApplicationController) 
    142       rescue LoadError => error 
    143         raise unless error.message =~ /application\.rb/ 
    144       end 
    145  
    146140      ActiveRecord::Base.verify_active_connections! if defined?(ActiveRecord) 
    147141 
    148142      if unprepared || force 
  • railties/test/initializer_test.rb

    old new  
    136136  end 
    137137end 
    138138 
     139uses_mocha "Checking application.rb tests" do 
     140  class Initializer_check_application_file_name_Test < Test::Unit::TestCase 
     141    def test_abort_if_application_file_exists 
     142      Rails::Initializer.any_instance.expects(:abort) 
     143      File.expects(:exist?).returns true 
     144      Rails::Initializer.run(:check_application_file_name) 
     145    end 
     146 
     147    def test_no_abort_if_application_file_does_not_exist 
     148      Rails::Initializer.any_instance.expects(:abort).never 
     149      File.expects(:exist?).returns false 
     150      Rails::Initializer.run(:check_application_file_name) 
     151    end 
     152  end 
     153end 
     154 
    139155uses_mocha "Initializer plugin loading tests" do 
    140156  require File.dirname(__FILE__) + '/plugin_test_helper' 
    141157 
  • railties/helpers/application.rb

    old new  
    1 # Filters added to this controller apply to all controllers in the application. 
    2 # Likewise, all the methods added will be available for all controllers. 
    3  
    4 class ApplicationController < ActionController::Base 
    5   helper :all # include all helpers, all the time 
    6  
    7   # See ActionController::RequestForgeryProtection for details 
    8   # Uncomment the :secret if you're not using the cookie session store 
    9   protect_from_forgery # :secret => '<%= app_secret %>' 
    10 end 
  • railties/helpers/application_controller.rb

    old new  
     1# Filters added to this controller apply to all controllers in the application. 
     2# Likewise, all the methods added will be available for all controllers. 
     3 
     4class ApplicationController < ActionController::Base 
     5  helper :all # include all helpers, all the time 
     6 
     7  # See ActionController::RequestForgeryProtection for details 
     8  # Uncomment the :secret if you're not using the cookie session store 
     9  protect_from_forgery # :secret => '<%= app_secret %>' 
     10end 
  • railties/lib/rails_generator/generators/applications/app/app_generator.rb

    old new  
    4747      m.file "README",         "README" 
    4848 
    4949      # Application 
    50       m.template "helpers/application.rb",        "app/controllers/application.rb", :assigns => { :app_name => @app_name, :app_secret => md5.hexdigest } 
     50      m.template "helpers/application_controller.rb", "app/controllers/application_controller.rb", :assigns => { :app_name => @app_name, :app_secret => md5.hexdigest } 
    5151      m.template "helpers/application_helper.rb", "app/helpers/application_helper.rb" 
    5252      m.template "helpers/test_helper.rb",        "test/test_helper.rb" 
    5353 
  • railties/lib/console_with_helpers.rb

    old new  
    1616  end 
    1717end 
    1818 
    19 require 'application' 
    20  
    2119class << helper  
    2220  include_all_modules_from ActionView 
    2321end 
  • railties/lib/initializer.rb

    old new  
    6161    # in order: 
    6262    # 
    6363    # * #check_ruby_version 
     64    # * #check_application_file_name 
    6465    # * #set_load_path 
    6566    # * #require_frameworks 
    6667    # * #set_autoload_paths 
     
    8384    # * #load_application_initializers 
    8485    def process 
    8586      check_ruby_version 
     87      check_application_file_name 
    8688      set_load_path 
    8789       
    8890      require_frameworks 
     
    123125      require 'ruby_version_check' 
    124126    end 
    125127 
     128    # Check for application.rb and suggest rename if it exists 
     129    def check_application_file_name 
     130      abort 'Please rename app/controllers/application.rb to app/controllers/application_controller.rb' if File.exist?("#{RAILS_ROOT}/app/controllers/application.rb") 
     131    end 
     132 
    126133    # Set the <tt>$LOAD_PATH</tt> based on the value of 
    127134    # Configuration#load_paths. Duplicates are removed. 
    128135    def set_load_path 
  • railties/lib/test_help.rb

    old new  
    1 require_dependency 'application' 
    2  
    31# Make double-sure the RAILS_ENV is set to test, 
    42# so fixtures are loaded to the right database 
    53silence_warnings { RAILS_ENV = "test" } 
  • railties/lib/commands/performance/request.rb

    old new  
    11#!/usr/bin/env ruby 
    22require 'config/environment' 
    3 require 'application' 
    43require 'action_controller/request_profiler' 
    54 
    65ActionController::RequestProfiler.run(ARGV)