This project is archived and is in readonly mode.

#6243 new
Steve Price

ActionController::Base.class_eval clobbers config.action_view value

Reported by Steve Price | December 31st, 2010 @ 11:19 PM

Calling ActionController::Base.class_eval clobbers the value of

% rails new foobar > /dev/null
% cd foobar
% rails c
Loading development environment (Rails 3.0.3)
ruby-1.9.2-p136 > Foobar::Application.config.action_view
 => {:stylesheet_expansions=>{}, :javascript_expansions=>{:defaults=>["prototype", "effects", "dragdrop", "controls", "rails"]}, :debug_rjs=>true} 
ruby-1.9.2-p136 > ActionController::Base.class_eval {}
 => nil 
ruby-1.9.2-p136 > Foobar::Application.config.action_view
 => {:debug_rjs=>true} 
ruby-1.9.2-p136 > quit

Below is a script that highlights one potential source for
the issue.

require 'rubygems'
gem 'rails', '3.0.3'
require 'rails/all'

module Rails
  module Initializable
    class Initializer
      def run(*args)
        # remove the next line to see action_view get clobbered
        return if :add_view_paths == @name
        @context.instance_exec(*args, &block)
module Foobar; class Application < Rails::Application; end; end

puts Foobar::Application.config.action_view
ActionController::Base.class_eval {}
puts Foobar::Application.config.action_view

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket