configatron-2.8.1/lib/configatron/store.rb:308:in `block in parse_options': undefined method `configure_from_hash' #16

Closed
sunteya opened this Issue Jun 22, 2011 · 3 comments

Projects

None yet

3 participants

@sunteya
sunteya commented Jun 22, 2011

The following code runs error :

configatron.import = "base/path"

configatron.bar = {
  :import => {
    :path => Configatron::Delayed.new { File.join(configatron.import, "bar") }
  }
}

Output :

/Users/sunteya/.rvm/gems/ruby-1.9.2-p180/gems/configatron-2.8.1/lib/configatron/store.rb:308:in `block in parse_options': undefined method `configure_from_hash' for "base/path":String (NoMethodError)
    from /Users/sunteya/.rvm/gems/ruby-1.9.2-p180/gems/configatron-2.8.1/lib/configatron/store.rb:303:in `each'
    from /Users/sunteya/.rvm/gems/ruby-1.9.2-p180/gems/configatron-2.8.1/lib/configatron/store.rb:303:in `parse_options'
    from /Users/sunteya/.rvm/gems/ruby-1.9.2-p180/gems/configatron-2.8.1/lib/configatron/store.rb:148:in `method_missing'
    from /Users/sunteya/.rvm/gems/ruby-1.9.2-p180/gems/configatron-2.8.1/lib/configatron/configatron.rb:15:in `method_missing'
    from /Users/sunteya/Workspaces/bstar/pukka/home_news_client/config/application.extra.rb:7:in `block (3 levels) in <class:Application>'
    from /Users/sunteya/Workspaces/bstar/pukka/home_news_client/config/application.rb:50:in `instance_eval'
    from /Users/sunteya/Workspaces/bstar/pukka/home_news_client/config/application.rb:50:in `block (3 levels) in <class:Application>'

Looks like the "configure_from_hash" method only run on the configatron object.

@benmoss
benmoss commented Jun 26, 2011

Also getting this same bug with configatron.configure_from_yaml

@markbates
Owner

I'll look into this. Just an FYI with the next configatron release I'm going to deprecate configure_from_yaml. It's preferred that you configure from Ruby not from YAML.

sunteya you should probably write your configuration like this:

configatron.bar.import.path = Configatron::Delayed.new { File.join(configatron.import, "bar") }

That's definitely a lot less typing. :)

@markbates markbates closed this Jun 28, 2011
@markbates
Owner

this should be fixed in 2.8.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment