norman / ambry

Ambry is a database and ORM replacement for (mostly) static models and small datasets. It provides ActiveModel compatibility, and flexible searching and storage.
http://rubydoc.info/github/norman/ambry/master/frames
MIT License
57 stars 3 forks source link

adapter name clash with default 'main' adapter #12

Closed mauriciopasquier closed 12 years ago

mauriciopasquier commented 12 years ago

Just Installed Ambry (and generated its files)

$ rails c
.../ambry-0.3.0/lib/ambry.rb:35:in `register_adapter': Adapter :main already registered (Ambry::AmbryError)

Digging the code I notice you don't set the name for File and YAML adapters, so I tried the following in adapters/yaml.rb:

  def initialize(options)
    options[:name] ||= :yaml
    super
  end

in adapters/file.rb:

  def initialize(options)
    @file_path = options[:file]
    @read_only  = !! options[:read_only]
    @lock      = Mutex.new
    options[:name] ||= :file
    super
  end

But those changes caused a lot of errors to the specs that I couldn't trace, sorry for not providing more code.

norman commented 12 years ago

Thanks; I've resolved this issue a bit differently and will make a release today.