I''d like to be able to display which db is the active db as I have a couple of development databases that I switch between, and I''d like the interface to remind me which one I''m dealing with by displaying some of. Can someone point me somewhere where I can have it show me the name of the database that''s being accessed? Thanks, -Al --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You could do it like this: require ''yaml'' config = YAML.load(File.open(''config/database.yml'')) config[''development''][''database''] Cheers, Mischa -- http://boxroom.rubyforge.org -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> I''d like to be able to display which db is the active db as > I have a couple of development databases that I switch between, > and I''d like the interface to remind me which one I''m dealing with by > displaying some of. > > Can someone point me somewhere where I can have it show me the name of > the database that''s being accessed?I can''t, but here''s the code we use to read our ''site.yml'' file (for local config stuff) that follows the exact same format as database.yml... SITE_YAML = YAML::load(ERB.new(IO.read("#{RAILS_ROOT}/config/site.yml"), nil, ''-'').result) SITE_YAML_ENV = SITE_YAML[RAILS_ENV] So assuming you switched that over to database.yml then you could spit out SITE_YAML_ENV[''database''] and you''d have your current database... -philip --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---