Hi Chron:
Thanks for the reply.
Yes the initial case is working but there is something to be decided
there as well.
In application.rb
i use before_filter :switch_db
def switch_db
@db = Client.find_by_domain_name(request.env['HTTP_HOST'])
db_name = @db.database_name
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:host => "",
:username => "",
:password => "",
:database => db_name,
:port => "3333"
)
end
Initially it selects the db well but since application.rb is called
always the function gets executed each time and tries to find client in
the current db.
What condition shall be placed to by pass this function if there already
exists a database connection [other than with master].
Regards,
Priya Saini
--
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 [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
-~----------~----~----~----~------~----~------~--~---