table name of an object

Hi,

how can I find out the table name of an object?

For example I have the object ua of the class UserArticle: ua = UserArticle.find(1)

How can I find out it is saved in the table user_articles?

With AR::B.table_name :

UserArticle.table_name # => "user_articles"

If you have the name of the class in a string and you're following Rails conventions (and assuming you haven't a prefix or a suffix), then you can write :

'UserArticle'.tableize # => "user_articles"

   -- Jean-François.