Forum: Ruby on Rails Error with plugin module tree

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Adam m. (Guest)
on 2007-03-08 12:45
Hello,
I have created a cut down version of technoweenie's acts_as_attachment
for a project im working on. It has worked fine but now with what
appears to be a change to edge rails (did piston update on vendor/rails
this morning) it fails with the following error. I need the later
versions of edge rails for some active resource functions.

-----
Error:
A copy of Default::ImageBox::ActMethods has been removed from the module
tree but is still active!


I have attempted to fix with an addition to environment.rb

-----
config.load_once_paths




Here is my code for loading the plugin and the actsmethod.

--------
Init.rb
begin
  require 'image_science'
rescue LoadError
  # image_science not found
end
ActiveRecord::Base.send(:extend, Default::ImageBox::ActMethods)


-------
default/imagebox/image_box.rb

module Default # :nodoc:
  module ImageBox # :nodoc:

    module ActMethods
      def image_box(options = {})
        #set defaults
        options[:thumbnails]        ||= []
        options[:storage_location]  ||= File.join('assets', 'images')

        # only need to define these once on a class
        unless included_modules.include? InstanceMethods
          class_inheritable_accessor :box_options

          validates_presence_of :source

          before_save   :store_data
          after_save    :box_images
          after_destroy :destroy_box

          include InstanceMethods
          include FileSystemMethods
        end

        self.box_options = options
      end
    end
  end
end
Adam m. (Guest)
on 2007-03-08 12:46
I've realised that my commend on the piston update is misleading.

I have had the problem for a few weeks. The update i performed this
morning was a lazy hope its been fixed attempt.
This topic is locked and can not be replied to.