Yeah, that's it.  Is there a way to get the connection
handle other than just picking a random table/model and
backing into it from there?  Like:

  Author.connection.tables

Which would be the exact same thing as:

  Book.connection.tables

as long as "authors" and "books" were both in the same db.

Not really important now, I'll just do it the above
way, but it seemed a little inelegant and I couldn't
find a better way.  Just curious.

Thanks.

        -glenn


John Parker wrote:
> I think the method ActiveRecord::Base.connection#tables might be what
> your looking for.
> 
> (I found it documented under the PostgreSQLAdapter, but it seems to
> exist in the MySQL and SQLite adapters as well.)
> 
> -John
> 
> On Thu, Apr 17, 2008 at 4:24 PM, Glenn Little <[EMAIL PROTECTED]> wrote:
>>  Is there a simple way in rails to, for instance, iterate over
>>  all the tables in a database (without knowing ahead of time
>>  their names)?
>>
>>  I'd actually like to iterate over all columns, and it appears
>>  that I can with the column_names method, but I need the class
>>  on which to call column_names.
>>
>>  Thanks...
>>
>>         -glenn
>>
>>  >
>>
> 
> 
> 

--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to