Current User, Database etc

Are there methods for the model object to get the current_user, and
current_database? I was hoping that this would be available as methods
from the connection object.

For example
model.connection.db_user
model.connection.db_name

Is there a group for ActiveRecord, where I can post this?

YourActiveRecordModel.configurations[ Rails.env ][ ‘username’ ]
YourActiveRecordModel.configurations[ Rails.env ][ ‘database’ ]

Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr

On Tue, Jun 9, 2009 at 11:14 AM, Steve

Maurício Linhares wrote:

YourActiveRecordModel.configurations[ Rails.env ][ ‘username’ ]
YourActiveRecordModel.configurations[ Rails.env ][ ‘database’ ]

Maur�cio Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr

On Tue, Jun 9, 2009 at 11:14 AM, Steve

Thanks for your suggestion. However I am spcifying a dsn which includes
Username, and database. This approach has a couple of issues.

  1. The user may be logging in using Windows authentication. In that case
    database.yml will not have a value for User field.
  2. What if the application changes connection after starting up?

This is how you can get the info from an activerecord object, if
you’re not using active record or if you’re using a custom made
solution it obviously won’t work.

Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr

On Tue, Jun 9, 2009 at 12:26 PM, Steve