Skip to content

Setting connection.port inside a model class is ignored #189

@mpapper

Description

@mpapper

If I set the defaults for the couchdb database protocol, host, port etc using either a config/couchdb.yml file OR by calling CouchRest::Model::Base.configure do |config| ... these settings are not override-able even if specified explicitly in a model.

To illustrate:
put this in the config/couchdb.yml:

development:
protocol: http
host: localhost
port: 5984

Then make the following call in the rails console:

class ProjectG < CouchRest::Model::Base
use_database 'atlas'
connection.update(:host => 'app20068047.heroku.cloudant.com', :port => '443', :username=>'onedisceakeyreaturstreas', :password=>'XXXXX', :prefix=>nil,:suffix=>nil,:protocol=>'https')
end
ProjectG.database # => an error related to the call using the host/port/protocol set in the couchdb.yml

BUT if I move the coucgdb.yml out of config and restart my console and type the above class definition for ProjectG I get:

=> https://onedisceakeyreaturstreas:[email protected]:443/atlas

The error/fault is that the settings in couchdb.yml are never overrideable by any model class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions