warning: toplevel constant Configuration referenced by ActiveRecord::Base::Configuration

Hi,

I am facing the error msg mention in subject, and my theme doesn't change.

*** init.rb ******** require File.join(File.dirname(__FILE__), "lib", "fedena_theme") FedenaPlugin.register = {   :name=>"fedena_theme",   :description=>"Fedena Theme" }

******* /// the line 52 in init.rb showing error /////////////**** 52. current_theme = ActiveRecord::Base::Configuration.get_config_value "Color"

*****fedena_theme.rb ********** # TestPlugin require 'action_view/helpers/asset_tag_helper'

class FedenaTheme   COLORS = {1 => {:color => "#701288",:accent_color => "#4e0d5f",:border_color => "#8d41a0",:sort_order => 16},             2 => {:color => "#39a6ef",:accent_color => "#2874a7",:border_color => "#61b8f2",:sort_order => 24},             3 => {:color => "#006290",:accent_color => "#004465",:border_color => "#3381a6",:sort_order => 26}             }   FONTS ={1 =>{:text => "Arial", :value => "Arial"},2 =>{:text => "Verdana", :value => "Verdana, Arial"},3 =>{:text => "Comic Sans MS", :value => "Comic Sans MS, Arial"},4 =>{:text => "Georgia", :value => "Georgia, Times new Roman"},5 => {:text => "Times new Roman", :value => "Times new Roman"},6 => {:text => "Trebuchet MS", :value => "Trebuchet MS, Arial"},7 => {:text => "Garamond", :value => "Garamond, Times new Roman"}}   unloadable

  def self.general_settings_form     "configuration/theme_select"   end

  def self.available_themes     directory = "#{Rails.public_path}/themes"     themes = Dir.entries(directory).select {|entry| File.directory? File.join(directory,entry) and !(entry =='.' ||   entry == '..') }     return [['Default', 'default']]+themes.collect { |theme| [theme.titleize, theme] }   end

  def self.selected_theme     Configuration.get_config_value("Color")   end

  def self.selected_color_value     val = selected_theme     COLORS[val.to_i][:color]   end

end

********* Errors showing /vendor/plugins/fedena_theme/init.rb:52: warning: toplevel constant Configuration referenced by ActiveRecord::Base::Configuration

Please help, I dont understand the error and how to resolve this. I upgraded my App from Rails 2.3.5 to 2.3.10

The simplest way to trigger this warning (it's not Rails-related BTW) is this:

$ irb irb(main):001:0> class Foo irb(main):002:1> end => nil irb(main):003:0> Foo::Array.new (irb):3: warning: toplevel constant Array referenced by Foo::Array =>

So it seems that in addition to ActiveRecord::Base:Configuration there's another class called Configuration defined at the top level.

Did you define this class? If not, does any of your dependencies define this class?

Best regards

Greg Navis wrote in post #1183062:

The simplest way to trigger this warning (it's not Rails-related BTW) is this:

$ irb irb(main):001:0> class Foo irb(main):002:1> end => nil irb(main):003:0> Foo::Array.new (irb):3: warning: toplevel constant Array referenced by Foo::Array =>

So it seems that in addition to ActiveRecord::Base:Configuration there's another class called Configuration defined at the top level.

Did you define this class? If not, does any of your dependencies define this class?

As I told before in Rails 2.3.5 it was working fine, even though was showing this warning as well but even then I could change the theme, but in 2.3.10 its not changing the theme.

Greg Navis wrote in post #1183062:

The simplest way to trigger this warning (it's not Rails-related BTW) is this:

$ irb irb(main):001:0> class Foo irb(main):002:1> end => nil irb(main):003:0> Foo::Array.new (irb):3: warning: toplevel constant Array referenced by Foo::Array =>

So it seems that in addition to ActiveRecord::Base:Configuration there's another class called Configuration defined at the top level.

Did you define this class? If not, does any of your dependencies define this class?

As I told before in Rails 2.3.5 it was working fine, even though was showing this warning as well but even then I could change the theme, but in 2.3.10 its not changing the theme.

That does not answer the question.

If you search your code for Configuration does it find anything?

Colin

Colin Law wrote in post #1183067:

In that case your simplest solution may be to change the name of the model.

Colin

Colin Law wrote in post #1183079:

Yes I have a Configuration Model/Controler below are the links to controller, and model

In that case your simplest solution may be to change the name of the model.

Colin

If I change the model name, then I have to make a lot of changes in many other Controllers and where its been called and the migration too. so I get a lot of error messages.

Can u get any idea from the below tree diagram that if there any change possible can make it resolve the problem. I changed the configration folded name in fedena_theme app views but didnt do anything

The Configration model's file tree is App >-Views         >_Configuration.rb

And this plugin fedena themes files tree is

App -Vendor - Plugins- fedena_theme : :_ views     :_Configuration             : _theme_select.html     :_themes

A few global search and replace changes should do it. You don't need to change the controller or table name if you don't want to. I assume you have the source under a source control system such as git, and that you have good automated test coverage, which will make sure you catch everything.

Colin