This project is archived and is in readonly mode.
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
Foobar::Application.config.action_view.
% 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)
end
end
end
end
module Foobar; class Application < Rails::Application; end; end
Foobar::Application.initialize!
puts Foobar::Application.config.action_view
ActionController::Base.class_eval {}
puts Foobar::Application.config.action_view
Comments and changes to this ticket
-
Steve Price January 1st, 2011 @ 03:59 AM
Here's a patch that resolves the issue here. I'm investigating
whether the 'action_view.set_configs' initializer should go away
as well.diff --git a/actionpack/lib/action_view/railtie.rb b/actionpack/lib/action_view/railtie.rb index 501ec07..99eaecd 100644 --- a/actionpack/lib/action_view/railtie.rb +++ b/actionpack/lib/action_view/railtie.rb @@ -16,22 +16,11 @@ module ActionView end end - initializer "action_view.javascript_expansions" do |app| - ActiveSupport.on_load(:action_view) do - ActionView::Helpers::AssetTagHelper.register_javascript_expansion( - app.config.action_view.delete(:javascript_expansions) - ) - - ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion( - app.config.action_view.delete(:stylesheet_expansions) - ) - end - end - initializer "action_view.set_configs" do |app| ActiveSupport.on_load(:action_view) do app.config.action_view.each do |k,v| - send "#{k}=", v + send "#{k}=", v unless [:javascript_expansions, + :stylesheet_expansions].include? k end end end
-
mikle January 21st, 2011 @ 05:59 AM
michael jordan basketball shoes Jumpman23 Jordan,new jordan releases 2009 authentic retro jordan,jordan shoes for girls Authentic Retro Jordan Shoes,new michael jordan shoes Jordans For Sale,Buy Jordan sneakers Online,michael jordan sneakers Authentic Space Jams,cheap air force ones Authentic Jordans,michael jordan pictures Authentic Retro Jordan Shoes,custom air force ones Cheap Jordan Retro Shoes,buy wholesale products from Chinese Jumpman23 shoes .jordan air force ones Authentic Cheap Jordans,jordan shoes release dates Authentic Air Jordan Shoes,new jordan releases Authentic Air Jordans Authentic Jordan Air Shoes Air Retro Jordans Shoes.Air Jordan Sneakers.buy air jordans online.Cheap Nike Dunk Kicks.
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>