    # File lib/ramaze/contrib/sequel/image.rb, line 52
      def self.included(model)
        args = model::IMAGE
        set_foreign_key = args[:foreign_key]  || "#{args[:owner]}_id".downcase.to_sym
        set_many_to_one  = args[:many_to_one] ||    args[:owner].to_s.downcase.to_sym

        # Define schema
        model.set_schema do
          primary_key :id

          varchar :original # path to the original image
          varchar :mime, :size => 22 # average of /etc/mime.types

          time :created_at
          time :updated_at

          foreign_key set_foreign_key
        end

        # Define Relations
        model.many_to_one set_many_to_one

        # Define Hooks
        model.before_create :generate_thumbnails do
          generate_thumbnails
          self.created_at = Time.now
        end

        model.before_save :update_time do
          self.updated_at = Time.now
        end

        model.before_destroy :cleanup do
          cleanup if conf[:cleanup]
        end

        # Define singleton methods
        model.extend(SingletonMethods)

        # Define instance methods
        model.send(:include,
                   InstanceMethods,
                   Ramaze::Helper::CGI,
                   Ramaze::Helper::Link)

        args[:sizes].each do |size, *args|
          model.send(:define_method, size){ public_file(size) }
          model.send(:define_method, "#{size}_url"){ file(size) }
        end
      end