This project is archived and is in readonly mode.

#6774 new
le_fnord

AR#column_names doesn't get all columns

Reported by le_fnord | May 11th, 2011 @ 11:10 AM

on some tables I have the error "column doesn't exist", but they do.

I found the error in AR/base ... see diff:

diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index b2e058d..f132f7c 100644
--- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -701,7 +701,8 @@ module ActiveRecord #:nodoc:

   # Returns an array of column names as strings.
   def column_names
  •  @column_names = columns.map { |column| column.name }
    
  •  # @column_names ||= columns.map { |column| column.name }
    

    end

after that all columsn would be fetched,
I think it is a performance issue,
but I haven't another solution this time

No comments found

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages