Steve Eichert wrote:
I've been working on the SQL Server adapter recently and have a question
about the intended use of the :primary attribute on the Column class.  Is it
meant to hold a boolean indicating if the column is the primary key?  After
reviewing the various adapters it doesn't appear that any of them use the
primary attribute.  I'd like to make use of the attribute so that when I
dump a SQL Server database using db_schema_dump I can get the :primary_key
option on the create_table set appropriately.  The database I'm dumping is a
non-standard Rails db (no "id" column for the primary key).  Could someone
confirm that my intended use of the primary attribute on Column is
appropriate?

Thanks,
Steve
The primary attribute gets set in AciveRecord::Base.columns:

     def columns
       unless @columns
         @columns = connection.columns(table_name, "#{name} Columns")
@columns.each {|column| column.primary = column.name == primary_key}
       end
       @columns
     end

and records the fact that a certain column object represents a primary key column.

-- stefan

--
For rails performance tuning, see: http://railsexpress.de/blog
Subscription: http://railsexpress.de/blog/xml/rss20/feed.xml

_______________________________________________
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to