On Thu, Sep 03, 2009 at 12:02:05AM +0200, Stephan Wehner wrote:
> Josef Wolf wrote:
Thanks for your help, Stephan!

> > So I am looking for a possibility to specify the directory relatively.
> >     host: `pwd`/db/pgdata
> > or
> >     host: #{RAILS_DIR}/db/pgdata
> > or something.
> 
> Since config/database.yml is read through ERB, you can do stuff like
> 
> host: <%= RAILS_DIR %>/db/pgdata

Yeah, this works fine when I use RAILS_ROOT instead of RAILS_DIR.

> host: <%= `hostname` %>

Backticks don't seem to work here. I get a syntax error when I try it:

** Invoke db:create (first_time)                                            
** Invoke environment (first_time)                                          
** Execute environment                                                      
rake aborted!                                                               
syntax error on line 22, col 9: `  # port: 5432'                            
/usr/lib64/ruby/1.8/yaml.rb:133:in `load'                                   
/usr/lib64/ruby/1.8/yaml.rb:133:in `load'                                   
/usr/lib64/ruby/gems/1.8/gems/rails-2.1.1/lib/initializer.rb:716:in
** `database_configuration'

Where line 22 is the first line after the backtick that does _not_ start
with a comment.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to