activerecord · multiple-models · Rails · rails-environments · rubyonrails

How to find different environment configurations in rails

While working with a multiple-database application I came across the point where I had to juggle between different environment configurations. I had to pass connection hash to ActiveRecord::Base.establish_connection, something like this: ActiveRecord::Base.establish_connection ( :adapter=>"mysql", :host=>"localhost", :username=>"myuser", :password=>"mypass", :database => "somedatabase" ) This connection can be easily retrieved from ActiveRecord::Base.configurations, this is currently undocumented. Using ActiveRecord::Base.configurations,… Continue reading How to find different environment configurations in rails