This project is archived and is in readonly mode.
The rake tasks db:create and db:drop throws an error when the database.yml file is configured in a non default location.
The rake tasks
throws an error when the
database.yml file is
configured in a non default location.
database.yml file location is configured using
database_configuration_file attribute of
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION require File.join(File.dirname(__FILE__), 'boot') Rails::Initializer.run do |config| config.time_zone = 'UTC' # configure the database.yml file location config.database_configuration_file = File.join("c:/siteconfig/test", 'database.yml') end
the following error:
I am able to run the other rake tasks such as
>rake db:drop (in C:/test) rake aborted! No such file or directory - C:/test/config/database.yml
db:migrate. The rails application runs without any error.
I located the issue in
This task ignores the database config file location override in
task :load_config => :rails_env do require 'active_record' ActiveRecord::Base.configurations = Rails::Configuration.new.database_configuration end
environment.rb. Hence the location always defaults to
Comments and changes to this ticket
- State changed from new to open
- Tag changed from databases.rake, rake_dev to databasesrake, rake_dev
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
- Tag changed from databasesrake, rake_dev to configuration, database.yml, databasesrake, rake_dev
- Assigned user set to Santiago Pastorino
The issue seems to be solved when I change the
load_configtask to depend on the
environmenttask instead of
rails_envand remove the assignment to
ActiveRecord::Base.configurations. Is this a right approach? How can I test this?
I would like to know the reasoning behind allowing the path to database.yml to be configurable.
Also, there is at least one more issue concerning the database.yml path #1710
We have built a product using Rails framework. Most of our customers/field engineers have no ruby/rails background. When the product is installed, code resides in a directory with read permissions and log/config files reside in a directory with read/write permission. The config directory contain ONLY the files that an administrator can change, i.e.
app_config.yml. This done in order to avoid any mishaps in production systems.
This is a common pattern for a corporate deployment. When we deploy on EC2, an EBS volume stores the configuration and log files and AMI has the project source.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>