Non-Fatal Anonymous Module Error

2 views
Skip to first unread message

Anthony Eden

unread,
Nov 5, 2006, 11:06:25 AM11/5/06
to rubyonra...@googlegroups.com
I am receiving the following non-fatal error from Rails for a particular action:

Error calling Dispatcher.dispatch #<ArgumentError: Anonymous modules have no name to be referenced by>
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:313:in `to_constant_name'
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:270:in `autoloaded?'
./script/../config/../vendor/rails/activerecord/lib/active_record/base.rb:278:in `reset_subclasses'
./script/../config/../vendor/rails/activerecord/lib/active_record/base.rb:277:in `reset_subclasses'
./script/../config/../vendor/rails/railties/lib/dispatcher.rb:57:in `reset_application!'
./script/../config/../vendor/rails/railties/lib/dispatcher.rb:110:in `reset_after_dispatch'
./script/../config/../vendor/rails/railties/lib/dispatcher.rb:50:in `dispatch'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/lib/mongrel/rails.rb:85:in `process'
/usr/local/lib/ruby/gems/1.8/gems/mongrel- 0.3.13.1/lib/mongrel.rb:556:in `process_client'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/lib/mongrel.rb:555:in `process_client'
/usr/local/lib/ruby/gems/1.8/gems/mongrel- 0.3.13.1/lib/mongrel.rb:624:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/lib/mongrel.rb:623:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/lib/mongrel.rb:612:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel- 0.3.13.1/lib/mongrel.rb:952:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/lib/mongrel.rb:951:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel- 0.3.13.1/bin/mongrel_rails:119:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/lib/mongrel/command.rb:211:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel- 0.3.13.1/bin/mongrel_rails:227
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:393:in `load'
./script/../config/../vendor/rails/railties/lib/commands/servers/mongrel.rb:48
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:400:in `require'
./script/../config/../vendor/rails/railties/lib/commands/server.rb:39
script/server:3


I have a feeling it has something to do with this little bit of code:

aggregate_class = Class.new(ActiveWarehouse::Aggregate)

ActiveWarehouse::Aggregate extends from ActiveRecord::Base and instances are created as needed. Is there a proper way for me to construct these classes on the fly without causing this error? Thanks.

V/r
Anthony Eden

Rick Olson

unread,
Nov 5, 2006, 12:05:06 PM11/5/06
to rubyonra...@googlegroups.com
On 11/5/06, Anthony Eden <antho...@gmail.com> wrote:
> I am receiving the following non-fatal error from Rails for a particular
> action:
>
> Error calling Dispatcher.dispatch #<ArgumentError: Anonymous modules have no
> name to be referenced by>
> ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:313:in
> `to_constant_name'
> ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:270:in
> `autoloaded?'
>
> I have a feeling it has something to do with this little bit of code:
>
> aggregate_class = Class.new(ActiveWarehouse::Aggregate)
>
> ActiveWarehouse::Aggregate extends from ActiveRecord::Base and instances are
> created as needed. Is there a proper way for me to construct these classes
> on the fly without causing this error? Thanks.
>
> V/r
> Anthony Eden
>

Look at the stack trace, try overriding
ActiveWarehouse::Aggregate.autoloaded? so it returns false.

Also, please keep questions like this for the Rails list. This list
is for discussion on the core framework.

--
Rick Olson
http://weblog.techno-weenie.net
http://mephistoblog.com

Reply all
Reply to author
Forward
0 new messages