Permalink
Browse files

Get rid of warnings generated by calling obsolete .to_a method on a S…

…ymbol

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2341 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
Marcel Molina
Marcel Molina committed Sep 26, 2005
1 parent c5f53ca commit b25933f296e9f03e0e5c12d62f3d965a287b6671
@@ -54,12 +54,12 @@ def rename_column(table_name, column_name, new_column_name)
end
# Create a new index on the given table. By default, it will be named
- # <code>"#{table_name}_#{column_name.to_a.first}_index"</code>, but you
+ # <code>"#{table_name}_#{Array(column_name).first}_index"</code>, but you
# can explicitly name the index by passing <code>:name => "..."</code>
# as the last parameter. Unique indexes may be created by passing
# <code>:unique => true</code>.
def add_index(table_name, column_name, options = {})
- index_name = "#{table_name}_#{column_name.to_a.first}_index"
+ index_name = "#{table_name}_#{Array(column_name).first}_index"
if Hash === options # legacy support, since this param was a string
index_type = options[:unique] ? "UNIQUE" : ""
@@ -68,7 +68,7 @@ def add_index(table_name, column_name, options = {})
index_type = options
end
- execute "CREATE #{index_type} INDEX #{index_name} ON #{table_name} (#{column_name.to_a.join(", ")})"
+ execute "CREATE #{index_type} INDEX #{index_name} ON #{table_name} (#{Array(column_name).join(", ")})"
end
# Remove the given index from the table.
@@ -134,4 +134,4 @@ def add_column_options!(sql, options) #:nodoc:
end
end
end
-end
+end

0 comments on commit b25933f

Please sign in to comment.