I am doing like this
"
ActiveRecord::Base.establish_connection(
:adapter => "mysql" ,
:host => "localhost" ,
:database => "railsdatabase" ,
:username => "railsusername" ,
:password => "railspassword"
)"
contact=Contact.find(2)
contact.name="Tushar Gandhi"
contact.save"
Whether it will point to the "contacts" table of "development2"
database.
Whether this will work? beacuse I haven't made any connection reference
for "contacts" code.
Can anyone please help me out for this.
Thanks,
Tushar
--
Posted via http://www.ruby-forum.com/.
in contact.rb
class Contact < ActiveRecord::Base
establish_connection(:development2)
end
in database.yml:
development2:
adapter: mysql
host: localhost
database: railsdatabase
username: railsusername
password: railspassword