Sha256: 2860de7a9957dac8815a2c52a0bdd7c86aaddf82881c05153ccbd7d957733e59

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

if defined?(Merb::Plugins)
  Merb::Plugins.config[:merb_sequel] = {}
  require File.join(File.dirname(__FILE__) / "sequel_ext" / "model")
  require File.join(File.dirname(__FILE__) / "merb" / "orms" / "sequel" / "connection")
  Merb::Plugins.add_rakefiles "merb_sequel" / "merbtasks"
  
  class Merb::Orms::Sequel::Connect < Merb::BootLoader

    after BeforeAppLoads

    def self.run
      Merb::Orms::Sequel.connect
      if Merb::Config.session_stores.include?(:sequel)
        Merb.logger.debug "Using Sequel sessions"
        require File.join(File.dirname(__FILE__) / "merb" / "session" / "sequel_session")
      end
      
      Merb::Router.root_behavior = Merb::Router.root_behavior.identify(Sequel::Model => :id)
    end

  end
  
  class Merb::Orms::Sequel::DisconnectBeforeFork < Merb::BootLoader
    after AfterAppLoads
    
    def self.run
      Merb.logger.debug "Disconnecting database connection before forking."
      ::Sequel::DATABASES.each { |db| db.disconnect }
    end
    
  end
  
  generators = File.join(File.dirname(__FILE__), 'generators')
  Merb.add_generators generators / :migration
  Merb.add_generators generators / :model
  Merb.add_generators generators / :resource_controller
  Merb.add_generators generators / :session_migration
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
merb_sequel-0.9.14 lib/merb_sequel.rb