sinatra-activerecord/sinatra-activerecord

Wrong path location for relative config file

Opened this issue · 0 comments

Hi,
using sinatra 4.0.0 and sinatra-activerecord 2.0.27 I observed this problem:

As long as I don't configure the database in my application, but just have a config/database.yml in the root directory of my application (i.e. the CWD of the running process), things work.

But once I set something like

set :database_file, "config/database.yml"

things break with an error message

Errno::ENOENT: No such file or directory @ rb_sysopen - ${PATH_of_my_Gems_dir}/gems/sinatra-contrib-4.0.0/lib/sinatra/config/database.yml (Errno::ENOENT)
${PATH_of_my_Gems_dir}//gems/sinatra-activerecord-2.0.27/lib/sinatra/activerecord.rb:78:in read' ${PATH_of_my_Gems_dir}//gems/sinatra-activerecord-2.0.27/lib/sinatra/activerecord.rb:78:in database_file='

It then tries to read the database file from a wrong location, i.e. within the gems repository instead of the running application or the CWD where the process was run.