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

Changeset 7719

Show
Ignore:
Timestamp:
10/02/07 05:32:14 (1 year ago)
Author:
bitsweat
Message:

Ruby 1.9 compat, consistent load paths

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionmailer/lib/action_mailer/helpers.rb

    r4312 r7719  
    5050                require_dependency(file_name) 
    5151              rescue LoadError => load_error 
    52                 requiree = / -- (.*?)(\.rb)?$/.match(load_error).to_a[1] 
     52                requiree = / -- (.*?)(\.rb)?$/.match(load_error.message).to_a[1] 
    5353                msg = (requiree == file_name) ? "Missing helper file helpers/#{file_name}.rb" : "Can't load file: #{requiree}" 
    5454                raise LoadError.new(msg).copy_blame!(load_error) 
     
    7373          master_helper_module.module_eval <<-end_eval 
    7474            def #{method}(*args, &block) 
    75               controller.send(%(#{method}), *args, &block) 
     75              controller.send!(%(#{method}), *args, &block) 
    7676            end 
    7777          end_eval 
     
    9393          begin 
    9494            child.master_helper_module = Module.new 
    95             child.master_helper_module.send :include, master_helper_module 
     95            child.master_helper_module.send! :include, master_helper_module 
    9696            child.helper child.name.underscore 
    9797          rescue MissingSourceFile => e 
  • trunk/actionpack/lib/action_controller/assertions.rb

    r7602 r7719  
    4747      %w(response selector tag dom routing model).each do |kind| 
    4848        require "action_controller/assertions/#{kind}_assertions" 
    49         klass.send :include, const_get("#{kind.camelize}Assertions") 
     49        klass.module_eval { include const_get("#{kind.camelize}Assertions") } 
    5050      end 
    5151    end 
  • trunk/actionpack/lib/action_controller/base.rb

    r7668 r7719  
    393393      def hidden_actions 
    394394        unless read_inheritable_attribute(:hidden_actions) 
    395           write_inheritable_attribute(:hidden_actions, ActionController::Base.public_instance_methods
     395          write_inheritable_attribute(:hidden_actions, ActionController::Base.public_instance_methods.map(&:to_s)
    396396        end 
    397397 
     
    401401      # Hide each of the given methods from being callable as actions. 
    402402      def hide_action(*names) 
    403         write_inheritable_attribute(:hidden_actions, hidden_actions | names.collect { |n| n.to_s }
    404       end 
    405        
     403        write_inheritable_attribute(:hidden_actions, hidden_actions | names.map(&:to_s)
     404      end 
     405 
    406406 
    407407      @@view_paths = {} 
    408        
     408 
    409409      # View load paths determine the bases from which template references can be made. So a call to 
    410410      # render("test/template") will be looked up in the view load paths array and the closest match will be 
     
    845845            if collection = options[:collection] 
    846846              render_for_text( 
    847                 @template.send(:render_partial_collection, partial, collection,  
     847                @template.send!(:render_partial_collection, partial, collection,  
    848848                options[:spacer_template], options[:locals]), options[:status] 
    849849              ) 
    850850            else 
    851851              render_for_text( 
    852                 @template.send(:render_partial, partial,  
     852                @template.send!(:render_partial, partial,  
    853853                ActionView::Base::ObjectWrapper.new(options[:object]), options[:locals]), options[:status] 
    854854              ) 
     
    857857          elsif options[:update] 
    858858            add_variables_to_assigns 
    859             @template.send :evaluate_assigns 
     859            @template.send! :evaluate_assigns 
    860860 
    861861            generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(@template, &block) 
     
    11051105          render unless performed? 
    11061106        elsif respond_to? :method_missing 
    1107           send(:method_missing, action_name) 
     1107          method_missing action_name 
    11081108          render unless performed? 
    11091109        elsif template_exists? && template_public? 
     
    11361136 
    11371137      def self.action_methods 
    1138         @action_methods ||= Set.new(public_instance_methods - hidden_actions) 
     1138        @action_methods ||= Set.new(public_instance_methods.map(&:to_s)) - hidden_actions 
    11391139      end 
    11401140 
  • trunk/actionpack/lib/action_controller/caching.rb

    r7666 r7719  
    239239            controller.rendered_action_cache = true 
    240240            set_content_type!(controller, cache_path.extension) 
    241             controller.send(:render_for_text, cache) 
     241            controller.send!(:render_for_text, cache) 
    242242            false 
    243243          else 
     
    471471          if ActionController::Base.allow_concurrency 
    472472            @mutex = Mutex.new 
    473             MemoryStore.send(:include, ThreadSafety) 
     473            MemoryStore.module_eval { include ThreadSafety } 
    474474          end 
    475475        end 
     
    561561            if ActionController::Base.allow_concurrency 
    562562              @mutex = Mutex.new 
    563               FileStore.send(:include, ThreadSafety) 
     563              FileStore.module_eval { include ThreadSafety } 
    564564            end 
    565565          end 
     
    643643            action_callback_method_name     = "#{controller_callback_method_name}_#{controller.action_name}" 
    644644 
    645             send(controller_callback_method_name) if respond_to?(controller_callback_method_name) 
    646             send(action_callback_method_name)     if respond_to?(action_callback_method_name) 
     645            send!(controller_callback_method_name) if respond_to?(controller_callback_method_name, true) 
     646            send!(action_callback_method_name)     if respond_to?(action_callback_method_name, true) 
    647647          end 
    648648 
    649649          def method_missing(method, *arguments) 
    650650            return if @controller.nil? 
    651             @controller.send(method, *arguments) 
     651            @controller.send!(method, *arguments) 
    652652          end 
    653653      end 
  • trunk/actionpack/lib/action_controller/cgi_process.rb

    r7382 r7719  
    4343      @cgi = cgi 
    4444      @session_options = session_options 
    45       @env = @cgi.send(:env_table) 
     45      @env = @cgi.send!(:env_table) 
    4646      super() 
    4747    end 
     
    139139 
    140140    def method_missing(method_id, *arguments) 
    141       @cgi.send(method_id, *arguments) rescue super 
     141      @cgi.send!(method_id, *arguments) rescue super 
    142142    end 
    143143 
     
    192192        output.write(@cgi.header(@headers)) 
    193193 
    194         if @cgi.send(:env_table)['REQUEST_METHOD'] == 'HEAD' 
     194        if @cgi.send!(:env_table)['REQUEST_METHOD'] == 'HEAD' 
    195195          return 
    196196        elsif @body.respond_to?(:call) 
  • trunk/actionpack/lib/action_controller/components.rb

    r7438 r7719  
    3737  module Components 
    3838    def self.included(base) #:nodoc: 
    39       base.send :include, InstanceMethods 
    40       base.extend(ClassMethods) 
     39      base.class_eval do 
     40        include InstanceMethods 
     41        extend ClassMethods 
    4142 
    42       base.helper do 
    43         def render_component(options) 
    44           @controller.send(:render_component_as_string, options) 
     43        helper do 
     44          def render_component(options) 
     45            @controller.send!(:render_component_as_string, options) 
     46          end 
    4547        end 
    46       end 
    4748 
    48       # If this controller was instantiated to process a component request, 
    49       # +parent_controller+ points to the instantiator of this controller. 
    50       base.send :attr_accessor, :parent_controller 
     49        # If this controller was instantiated to process a component request, 
     50        # +parent_controller+ points to the instantiator of this controller. 
     51        attr_accessor :parent_controller 
    5152 
    52       base.class_eval do 
    5353        alias_method_chain :process_cleanup, :components 
    5454        alias_method_chain :set_session_options, :components 
  • trunk/actionpack/lib/action_controller/dispatcher.rb

    r7641 r7719  
    7272 
    7373        def log_failsafe_exception(status, exception) 
    74           message = "/!\ FAILSAFE /!\  #{Time.now}\n  Status: #{status}\n" 
     74          message = "/!\\ FAILSAFE /!\\  #{Time.now}\n  Status: #{status}\n" 
    7575          message << "  #{exception}\n    #{exception.backtrace.join("\n    ")}" if exception 
    7676          failsafe_logger.fatal message 
     
    137137 
    138138    def prepare_application(force = false) 
    139       require_dependency 'application' unless defined?(::ApplicationController) 
     139      begin 
     140        require_dependency 'application' unless defined?(::ApplicationController) 
     141      rescue LoadError => error 
     142        raise unless error.message =~ /application\.rb/ 
     143      end 
     144 
    140145      ActiveRecord::Base.verify_active_connections! if defined?(ActiveRecord) 
    141146 
     
    167172 
    168173      def run_callbacks(kind, enumerator = :each) 
    169         callbacks[kind].send(enumerator) do |callback| 
     174        callbacks[kind].send!(enumerator) do |callback| 
    170175          case callback 
    171176          when Proc; callback.call(self) 
    172           when String, Symbol; send(callback) 
     177          when String, Symbol; send!(callback) 
    173178          when Array; callback[1].call(self) 
    174179          else raise ArgumentError, "Unrecognized callback #{callback.inspect}" 
  • trunk/actionpack/lib/action_controller/filters.rb

    r7438 r7719  
    22  module Filters #:nodoc: 
    33    def self.included(base) 
    4       base.extend(ClassMethods) 
    5       base.send(:include, ActionController::Filters::InstanceMethods) 
     4      base.class_eval do 
     5        extend ClassMethods 
     6        include ActionController::Filters::InstanceMethods 
     7      end 
    68    end 
    79 
     
    441443          # only filters returning false are halted. 
    442444          if false == @filter.call(controller) 
    443             controller.send :halt_filter_chain, @filter, :returned_false 
     445            controller.send! :halt_filter_chain, @filter, :returned_false 
    444446          end 
    445447        end 
     
    467469      class SymbolFilter < Filter #:nodoc: 
    468470        def call(controller, &block) 
    469           controller.send(@filter, &block) 
     471          controller.send!(@filter, &block) 
    470472        end 
    471473      end 
     
    657659          Proc.new do |controller, action| 
    658660            if filter.before(controller) == false 
    659               controller.send :halt_filter_chain, filter, :returned_false 
     661              controller.send! :halt_filter_chain, filter, :returned_false 
    660662            else 
    661663              begin 
  • trunk/actionpack/lib/action_controller/flash.rb

    r7428 r7719  
    2626  module Flash 
    2727    def self.included(base) 
    28       base.send :include, InstanceMethods 
    29  
    3028      base.class_eval do 
     29        include InstanceMethods 
    3130        alias_method_chain :assign_shortcuts, :flash 
    3231        alias_method_chain :process_cleanup,  :flash 
  • trunk/actionpack/lib/action_controller/helpers.rb

    r7666 r7719  
    6969      # available to the templates. 
    7070      def add_template_helper(helper_module) #:nodoc: 
    71         master_helper_module.send(:include, helper_module) 
     71        master_helper_module.module_eval { include helper_module } 
    7272      end 
    7373 
     
    170170      private 
    171171        def default_helper_module! 
    172           module_name = name.sub(/Controller$|$/, 'Helper') 
    173           module_path = module_name.split('::').map { |m| m.underscore }.join('/') 
    174           require_dependency module_path 
    175           helper module_name.constantize 
     172          unless name.blank? 
     173            module_name = name.sub(/Controller$|$/, 'Helper') 
     174            module_path = module_name.split('::').map { |m| m.underscore }.join('/') 
     175            require_dependency module_path 
     176            helper module_name.constantize 
     177          end 
    176178        rescue MissingSourceFile => e 
    177179          raise unless e.is_missing? module_path 
     
    187189          begin 
    188190            child.master_helper_module = Module.new 
    189             child.master_helper_module.send :include, master_helper_module 
    190             child.send :default_helper_module! 
     191            child.master_helper_module.send! :include, master_helper_module 
     192            child.send! :default_helper_module! 
    191193          rescue MissingSourceFile => e 
    192194            raise unless e.is_missing?("helpers/#{child.controller_path}_helper") 
  • trunk/actionpack/lib/action_controller/http_authentication.rb

    r7438 r7719  
    122122      def authentication_request(controller, realm) 
    123123        controller.headers["WWW-Authenticate"] = %(Basic realm="#{realm.gsub(/"/, "")}") 
    124         controller.send :render, :text => "HTTP Basic: Access denied.\n", :status => :unauthorized 
    125         return false     
     124        controller.send! :render, :text => "HTTP Basic: Access denied.\n", :status => :unauthorized 
     125        return false 
    126126      end 
    127127    end 
  • trunk/actionpack/lib/action_controller/integration.rb

    r7666 r7719  
    8484          # the helpers are made protected by default--we make them public for 
    8585          # easier access during testing and troubleshooting. 
    86           klass.send(:public, *Routing::Routes.named_routes.helpers) 
     86          klass.module_eval { public *Routing::Routes.named_routes.helpers } 
    8787          @named_routes_configured = true 
    8888        end 
     
    253253 
    254254          unless ActionController::Base.respond_to?(:clear_last_instantiation!) 
    255             ActionController::Base.send(:include, ControllerCapture) 
     255            ActionController::Base.module_eval { include ControllerCapture } 
    256256          end 
    257257 
     
    499499        # reset the html_document variable, but only for new get/post calls 
    500500        @html_document = nil unless %w(cookies assigns).include?(method) 
    501         returning @integration_session.send(method, *args) do 
     501        returning @integration_session.send!(method, *args) do 
    502502          copy_session_variables! 
    503503        end 
     
    523523        name = table_name.tr(".", "_") 
    524524        next unless respond_to?(name) 
    525         extras.send(:define_method, name) { |*args| delegate.send(name, *args) } 
     525        extras.send!(:define_method, name) { |*args| delegate.send(name, *args) } 
    526526      end 
    527527 
    528528      # delegate add_assertion to the test case 
    529       extras.send(:define_method, :add_assertion) { test_result.add_assertion } 
     529      extras.send!(:define_method, :add_assertion) { test_result.add_assertion } 
    530530      session.extend(extras) 
    531531      session.delegate = self 
     
    541541      return unless @integration_session 
    542542      %w(controller response request).each do |var| 
    543         instance_variable_set("@#{var}", @integration_session.send(var)) 
     543        instance_variable_set("@#{var}", @integration_session.send!(var)) 
    544544      end 
    545545    end 
     
    548548    def method_missing(sym, *args, &block) 
    549549      reset! unless @integration_session 
    550       returning @integration_session.send(sym, *args, &block) do 
     550      returning @integration_session.send!(sym, *args, &block) do 
    551551        copy_session_variables! 
    552552      end 
  • trunk/actionpack/lib/action_controller/layout.rb

    r7701 r7719  
    195195        def inherited_with_layout(child) 
    196196          inherited_without_layout(child) 
    197           layout_match = child.name.underscore.sub(/_controller$/, '').sub(/^controllers\//, '') 
    198           child.layout(layout_match, {}, true) unless child.layout_list.grep(%r{layouts/#{layout_match}(\.[a-z][0-9a-z]*)+$}).empty? 
     197          unless child.name.blank? 
     198            layout_match = child.name.underscore.sub(/_controller$/, '').sub(/^controllers\//, '') 
     199            child.layout(layout_match, {}, true) unless child.layout_list.grep(%r{layouts/#{layout_match}(\.[a-z][0-9a-z]*)+$}).empty? 
     200          end 
    199201        end 
    200202 
     
    231233      active_layout = case layout 
    232234        when String then layout 
    233         when Symbol then send(layout) 
     235        when Symbol then send!(layout) 
    234236        when Proc   then layout.call(self) 
    235237      end 
     
    317319        view_paths.find do |path|  
    318320          next unless template_path = Dir[File.join(path, 'layouts', layout_name) + ".*"].first 
    319           self.class.send(:layout_directory_exists_cache)[File.dirname(template_path)] 
     321          self.class.send!(:layout_directory_exists_cache)[File.dirname(template_path)] 
    320322        end 
    321323      end 
  • trunk/actionpack/lib/action_controller/mime_responds.rb

    r7681 r7719  
    22  module MimeResponds #:nodoc: 
    33    def self.included(base) 
    4       base.send(:include, ActionController::MimeResponds::InstanceMethods) 
     4      base.module_eval do 
     5        include ActionController::MimeResponds::InstanceMethods 
     6      end 
    57    end 
    68 
  • trunk/actionpack/lib/action_controller/mime_type.rb

    r7520 r7719  
    6060 
    6161      def register(string, symbol, mime_type_synonyms = [], extension_synonyms = [], skip_lookup = false) 
    62         Mime.send :const_set, symbol.to_s.upcase, Type.new(string, symbol, mime_type_synonyms) 
     62        Mime.instance_eval { const_set symbol.to_s.upcase, Type.new(string, symbol, mime_type_synonyms) } 
    6363 
    64         SET << Mime.send(:const_get, symbol.to_s.upcase) 
     64        SET << Mime.const_get(symbol.to_s.upcase) 
    6565 
    6666        ([string] + mime_type_synonyms).each { |string| LOOKUP[string] = SET.last } unless skip_lookup 
  • trunk/actionpack/lib/action_controller/polymorphic_routes.rb

    r7438 r7719  
    77       
    88      args = case record_or_hash_or_array 
    9         when Hash:  [ record_or_hash_or_array ] 
    10         when Array: record_or_hash_or_array.dup 
     9        when Hash;  [ record_or_hash_or_array ] 
     10        when Array; record_or_hash_or_array.dup 
    1111        else        [ record_or_hash_or_array ] 
    1212      end 
     
    2525       
    2626      named_route = build_named_route_call(record_or_hash_or_array, namespace, inflection, options) 
    27       send(named_route, *args) 
     27      send!(named_route, *args) 
    2828    end 
    2929 
     
    5656      def build_named_route_call(records, namespace, inflection, options = {}) 
    5757        records = Array.new([extract_record(records)]) unless records.is_a?(Array)         
    58         base_segment = "#{RecordIdentifier.send("#{inflection}_class_name", records.pop)}_" 
     58        base_segment = "#{RecordIdentifier.send!("#{inflection}_class_name", records.pop)}_" 
    5959 
    6060        method_root = records.reverse.inject(base_segment) do |string, name| 
    61           segment = "#{RecordIdentifier.send("singular_class_name", name)}_" 
     61          segment = "#{RecordIdentifier.send!("singular_class_name", name)}_" 
    6262          segment << string 
    6363        end 
     
    6868      def extract_record(record_or_hash_or_array) 
    6969        case record_or_hash_or_array 
    70           when Array: record_or_hash_or_array.last 
    71           when Hash:  record_or_hash_or_array[:id] 
     70          when Array; record_or_hash_or_array.last 
     71          when Hash;  record_or_hash_or_array[:id] 
    7272          else        record_or_hash_or_array 
    7373        end 
  • trunk/actionpack/lib/action_controller/request.rb

    r7502 r7719  
    110110    # every Ajax request.) 
    111111    def xml_http_request? 
    112       not /XMLHttpRequest/i.match(@env['HTTP_X_REQUESTED_WITH']).nil? 
     112      !(@env['HTTP_X_REQUESTED_WITH'] !~ /XMLHttpRequest/i) 
    113113    end 
    114114    alias xhr? :xml_http_request? 
     
    121121    # the originating IP. 
    122122    # 
    123     # Security note: Be aware that since remote_ip will check regular HTTP headers, 
    124     # it can be tricked by anyone setting those manually. In other words, people can 
    125     # pose as whatever IP address they like to this method. That doesn't matter if 
    126     # all your doing is using IP addresses for statistical or geographical information, 
    127     # but if you want to, for example, limit access to an administrative area by IP, 
    128     # you should instead use Request#remote_addr, which can't be spoofed (but also won't 
    129     # survive proxy forwards). 
     123    # Security note: do not use if IP spoofing is a concern for your 
     124    # application. Since remote_ip checks HTTP headers for addresses forwarded 
     125    # by proxies, the client may send any IP. remote_addr can't be spoofed but 
     126    # also doesn't work behind a proxy, since it's always the proxy's IP. 
    130127    def remote_ip 
    131128      return @env['HTTP_CLIENT_IP'] if @env.include? 'HTTP_CLIENT_IP' 
     
    223220          uri << '?' << env_qs 
    224221        end 
    225         @env['REQUEST_URI'] = uri 
     222 
     223        if uri.nil? 
     224          @env.delete('REQUEST_URI') 
     225          uri 
     226        else 
     227          @env['REQUEST_URI'] = uri 
     228        end 
    226229      end 
    227230    end 
  • trunk/actionpack/lib/action_controller/rescue.rb

    r7623 r7719  
    151151        @template.instance_variable_set("@exception", exception) 
    152152        @template.instance_variable_set("@rescues_path", File.dirname(rescues_path("stub"))) 
    153         @template.send(:assign_variables_from_controller) 
     153        @template.send!(:assign_variables_from_controller) 
    154154 
    155155        @template.instance_variable_set("@contents", @template.render_file(template_path_for_local_rescue(exception), false)) 
  • trunk/actionpack/lib/action_controller/resources.rb

    r7559 r7719  
    514514        require_id = !resource.kind_of?(SingletonResource) 
    515515        case default_options[:action] 
    516           when "index", "new" : default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements) 
    517           when "create"       : default_options.merge(add_conditions_for(resource.conditions, method || :post)).merge(resource.requirements) 
    518           when "show", "edit" : default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements(require_id)) 
    519           when "update"       : default_options.merge(add_conditions_for(resource.conditions, method || :put)).merge(resource.requirements(require_id)) 
    520           when "destroy"      : default_options.merge(add_conditions_for(resource.conditions, method || :delete)).merge(resource.requirements(require_id)) 
     516          when "index", "new"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements) 
     517          when "create";      default_options.merge(add_conditions_for(resource.conditions, method || :post)).merge(resource.requirements) 
     518          when "show", "edit"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements(require_id)) 
     519          when "update";      default_options.merge(add_conditions_for(resource.conditions, method || :put)).merge(resource.requirements(require_id)) 
     520          when "destroy";      default_options.merge(add_conditions_for(resource.conditions, method || :delete)).merge(resource.requirements(require_id)) 
    521521          else                  default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements) 
    522522        end 
     
    525525end 
    526526 
    527 ActionController::Routing::RouteSet::Mapper.send :include, ActionController::Resources 
     527class ActionController::Routing::RouteSet::Mapper 
     528  include ActionController::Resources 
     529end 
  • trunk/actionpack/lib/action_controller/routing.rb

    r7599 r7719  
    10931093          @module ||= Module.new 
    10941094          @module.instance_methods.each do |selector| 
    1095             @module.send :remove_method, selector 
     1095            @module.class_eval { remove_method selector } 
    10961096          end 
    10971097        end 
     
    11331133        def install(destinations = [ActionController::Base, ActionView::Base], regenerate = false) 
    11341134          reset! if regenerate 
    1135           Array(destinations).each { |dest| dest.send :include, @module } 
     1135          Array(destinations).each do |dest| 
     1136            dest.send! :include, @module 
     1137          end 
    11361138        end 
    11371139 
     
    11551157          def define_hash_access(route, name, kind, options) 
    11561158            selector = hash_access_name(name, kind) 
    1157             @module.send :module_eval, <<-end_eval # We use module_eval to avoid leaks 
     1159            @module.module_eval <<-end_eval # We use module_eval to avoid leaks 
    11581160              def #{selector}(options = nil) 
    11591161                options ? #{options.inspect}.merge(options) : #{options.inspect} 
    11601162              end 
     1163              protected :#{selector} 
    11611164            end_eval 
    1162             @module.send(:protected, selector) 
    11631165            helpers << selector 
    11641166          end 
     
    11831185            #   foo_url(bar, baz, bang, :sort_by => 'baz') 
    11841186            # 
    1185             @module.send :module_eval, <<-end_eval # We use module_eval to avoid leaks 
     1187            @module.module_eval <<-end_eval # We use module_eval to avoid leaks 
    11861188              def #{selector}(*args) 
    11871189                #{generate_optimisation_block(route, kind)} 
     
    12001202                url_for(#{hash_access_method}(opts)) 
    12011203              end 
     1204              protected :#{selector} 
    12021205            end_eval 
    1203             @module.send(:protected, selector) 
    12041206            helpers << selector 
    12051207          end 
     
    12331235       
    12341236      def install_helpers(destinations = [ActionController::Base, ActionView::Base], regenerate_code = false) 
    1235         Array(destinations).each { |d| d.send :include, Helpers
     1237        Array(destinations).each { |d| d.module_eval { include Helpers }
    12361238        named_routes.install(destinations, regenerate_code) 
    12371239      end 
     
    13631365            # Used by caching to expire all paths for a resource 
    13641366            return routes.collect do |route| 
    1365               route.send(method, options, merged, expire_on) 
     1367              route.send!(method, options, merged, expire_on) 
    13661368            end.compact 
    13671369          end 
     
    13711373 
    13721374          routes.each do |route| 
    1373             results = route.send(method, options, merged, expire_on) 
     1375            results = route.send!(method, options, merged, expire_on) 
    13741376            return results if results && (!results.is_a?(Array) || results.first) 
    13751377          end 
  • trunk/actionpack/lib/action_controller/session_management.rb

    r7364 r7719  
    99  module SessionManagement #:nodoc: 
    1010    def self.included(base) 
    11       base.extend(ClassMethods) 
    12        
    13       base.send :alias_method_chain, :process, :session_management_support 
    14       base.send :alias_method_chain, :process_cleanup, :session_management_support 
     11      base.class_eval do 
     12        extend ClassMethods 
     13        alias_method_chain :process, :session_management_support 
     14        alias_method_chain :process_cleanup, :session_management_support 
     15      end 
    1516    end 
    1617 
  • trunk/actionpack/lib/action_controller/test_process.rb

    r7478 r7719  
    358358 
    359359    def method_missing(method_name, *args, &block) #:nodoc: 
    360       @tempfile.send(method_name, *args, &block) 
     360      @tempfile.send!(method_name, *args, &block) 
    361361    end 
    362362  end 
     
    380380      # understandable error message. 
    381381      %w(@controller @request @response).each do |iv_name| 
    382         if !instance_variables.include?(iv_name) || instance_variable_get(iv_name).nil? 
     382        if !(instance_variables.include?(iv_name) || instance_variables.include?(iv_name.to_sym)) || instance_variable_get(iv_name).nil? 
    383383          raise "#{iv_name} is nil: make sure you set it in your test's setup method." 
    384384        end 
     
    403403      @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' 
    404404      @request.env['HTTP_ACCEPT'] = 'text/javascript, text/html, application/xml, text/xml, */*' 
    405       returning self.send(request_method, action, parameters, session, flash) do 
     405      returning send!(request_method, action, parameters, session, flash) do 
    406406        @request.env.delete 'HTTP_X_REQUESTED_WITH' 
    407407        @request.env.delete 'HTTP_ACCEPT' 
     
    445445    def build_request_uri(action, parameters) 
    446446      unless @request.env['REQUEST_URI'] 
    447         options = @controller.send(:rewrite_options, parameters) 
     447        options = @controller.send!(:rewrite_options, parameters) 
    448448        options.update(:only_path => true, :action => action) 
    449449 
     
    467467 
    468468    def method_missing(selector, *args) 
    469       return @controller.send(selector, *args) if ActionController::Routing::Routes.named_routes.helpers.include?(selector) 
     469      return @controller.send!(selector, *args) if ActionController::Routing::Routes.named_routes.helpers.include?(selector) 
    470470      return super 
    471471    end 
     
    503503    def with_routing 
    504504      real_routes = ActionController::Routing::Routes 
    505       ActionController::Routing.send :remove_const, :Routes 
     505      ActionController::Routing.module_eval { remove_const :Routes } 
    506506 
    507507      temporary_routes = ActionController::Routing::RouteSet.new 
    508       ActionController::Routing.send :const_set, :Routes, temporary_routes 
    509    
     508      ActionController::Routing.module_eval { const_set :Routes, temporary_routes } 
     509 
    510510      yield temporary_routes 
    511511    ensure 
    512512      if ActionController::Routing.const_defined? :Routes 
    513         ActionController::Routing.send(:remove_const, :Routes)  
     513    &nb