Hi, I'm working on the active_scaffold_export plugin and it's throwing
an error during the initial configuration. I've narrowed down where the
error is coming from, but I can't see why the code is wrong - it seems
like it works the same way as the core AS code?
So my backtrace is this:
/home/src/ruby/rails/UserAdmin/vendor/plugins/active_scaffold/lib/active_scaffold.rb:17:in
`set_defaults': undefined method `configure' for
ActiveScaffold::Config::Core:Class (NoMethodError)
from
/home/src/ruby/rails/UserAdmin/app/controllers/application_controller.rb:34
from
/usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from
/usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:158:in
`require'
from
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:265:in
`require_or_load'
from
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:224:in
`depend_on'
from
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:136:in
`require_dependency'
from
/usr/lib64/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:393:in
`load_application_classes'
... 14 levels...
from
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb:5:in
`load'
from
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb:5
from
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb:5:in
`each'
from
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb:5
/usr/bin/ruby18 -Ilib:test
"/usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb"
The code triggering the problem (ie application_controller.rb:35) is
just the default config
ActiveScaffold.set_defaults do |config|
config.list.per_page = 20
end
And the errant code in ASE is this:
module ActiveScaffold::Config
class Core
cattr_accessor :export_show_form, :export_allow_full_download,
:export_force_quotes, :export_default_full_download,
:export_default_delimiter, :export_default_skip_header
@@export_show_form = true
@@export_allow_full_download = true
@@export_default_full_download = true
@@export_force_quotes = false
@@export_default_skip_header = false
@@export_default_delimiter = ','
ActionController::Resources::Resource::ACTIVE_SCAFFOLD_ROUTING[:collection][:show_export]
= :get
end
end
If I change the code to be
class Core < Base
Then the backtrace becomes:
/home/src/ruby/rails/UserAdmin/vendor/plugins/active_scaffold/lib/active_scaffold/configurable.rb:24:in
`send': undefined method `list' for ApplicationController:Class
(NoMethodError)
from
/home/src/ruby/rails/UserAdmin/vendor/plugins/active_scaffold/lib/active_scaffold/configurable.rb:24:in
`method_missing'
from
/home/src/ruby/rails/UserAdmin/app/controllers/application_controller.rb:35
from
/home/src/ruby/rails/UserAdmin/vendor/plugins/active_scaffold/lib/active_scaffold/configurable.rb:11:in
`instance_eval'
from
/home/src/ruby/rails/UserAdmin/vendor/plugins/active_scaffold/lib/active_scaffold/configurable.rb:11:in
`configure'
from
/home/src/ruby/rails/UserAdmin/vendor/plugins/active_scaffold/lib/active_scaffold.rb:17:in
`set_defaults'
from
/home/src/ruby/rails/UserAdmin/app/controllers/application_controller.rb:34
.. into rails ...
Commenting out the whole "class Core" section stops the initialisation
errors altogether, so clearly the problem is that this code is masking
the whole AS ActiveScaffold::Config::Core definition?
This is obviously some bit of meta programming which isn't working out,
but I can't figure out what's going wrong
Can someone please shine a bit of light on what I need to do to make
this work?
Thanks
Ed W
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---