hello group, in order not to have passwords stored in my database.yml, I had inserted a function that read the password from a file that is not under version control.
The entry in database.yml looks like this: e: adapter: postgresql host: localhost template: template0 database: archive_e encoding: utf8 username: archive_e password: <%= read_pwd() %> pool: 5 # not mandatory timeout: 500 In config/environment.rb the function was defined: # Load the rails application require File.expand_path('../application', __FILE__) def read_pwd () File.open( File.join( File.dirname( __FILE__), '.pwd'), 'r') do |fh| fh.read end end # Initialize the rails application Varch::Application.initialize! This seemed to be a nice solution for quite some time, until I today had to rebuild my database. When I now try a db:setup or db:migrate, I get this error: $ rake db:setup RAILS_ENV=e /home/ruud/.rvm/gems/ruby-1.9.3-p551@rails32/gems/rspec-core-3.3.2/lib/rspec/core/shell_escape.rb:30: warning: already initialized constant SHELLS_ALLOWING_UNQUOTED_IDS rake aborted! NoMethodError: undefined method `read_pwd' for main:Object (erb):8:in `<main>' /home/ruud/.rvm/gems/ruby-1.9.3-p551@rails32/gems/railties-3.2.17/lib/rails/application/configuration.rb:115:in `database_configuration' /home/ruud/.rvm/gems/ruby-1.9.3-p551@rails32/gems/activerecord-3.2.17/lib/active_record/railties/databases.rake:25:in `block (2 levels) in <top (required)>' /home/ruud/.rvm/gems/ruby-1.9.3-p551@rails32/bin/ruby_executable_hooks:15:in `eval' /home/ruud/.rvm/gems/ruby-1.9.3-p551@rails32/bin/ruby_executable_hooks:15:in `<main>' Tasks: TOP => db:setup => db:schema:load_if_ruby => db:create => db:load_config (See full trace by running task with --trace) [1] 19621 exit 1 rake db:setup RAILS_ENV=e It must be very simple to solve this, but I would greatfully accept any help; I am out of ideas at the moment. I don't know how to instruct rake to include the file in which read_pwd is defined. thanks in advance, Ruud -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1e01fabb-1b47-415e-84c2-bc78442fddfb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.