Skip to content
Browse files

update AR::SchemaStatements#column_exists? documentation [ci skip]

  • Loading branch information...
1 parent 6b9d1a0 commit 6727e3c9e7eca006e5221739dc72694d2c1e024d Francesco Rodriguez committed Jun 30, 2012
View
6 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -57,15 +57,17 @@ def columns(table_name) end
# Checks to see if a column exists in a given table.
#
- # === Examples
# # Check a column exists
# column_exists?(:suppliers, :name)
#
# # Check a column exists of a particular type
# column_exists?(:suppliers, :name, :string)
#
# # Check a column exists with a specific definition
- # column_exists?(:suppliers, :name, :string, :limit => 100)
+ # column_exists?(:suppliers, :name, :string, limit: 100)
+ # column_exists?(:suppliers, :name, :string, default: 'default'
+ # column_exists?(:suppliers, :name, :string, null: false)
+ # column_exists?(:suppliers, :tax, :decimal, precision: 8, scale: 2)
def column_exists?(table_name, column_name, type = nil, options = {})
columns(table_name).any?{ |c| c.name == column_name.to_s &&
(!type || c.type == type) &&

0 comments on commit 6727e3c

Please sign in to comment.
Something went wrong with that request. Please try again.