提交 c5e03e87 编写于 作者: A Aaron Patterson

keep ivars private, do not manipulate them outside their owner object

上级 a724096c
......@@ -236,6 +236,10 @@ def column(name, type, options = {})
self
end
def remove_column(name)
@columns_hash.delete name.to_s
end
[:string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean].each do |column_type|
define_method column_type do |*args|
options = args.extract_options!
......
......@@ -458,7 +458,7 @@ def add_column(table_name, column_name, type, options = {}) #:nodoc:
def remove_column(table_name, column_name, type = nil, options = {}) #:nodoc:
alter_table(table_name) do |definition|
definition.columns.delete(definition[column_name])
definition.remove_column column_name
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册