Permalink
Browse files

New method for bulk adding of columns

  • Loading branch information...
1 parent 6467087 commit 5d16059c6717591d93afa60e17dc6eec9cb14fee Michal Zima committed Jul 21, 2009
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/activerecord-tableless.rb
@@ -70,6 +70,13 @@ def column(name, sql_type = nil, default = nil, null = true)
tableless_options[:columns] << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
end
+ # Register a set of colums with the same SQL type
+ def add_columns(sql_type, *args)
+ args.each do |col|
+ column col, sql_type
+ end
+ end
+
%w(find create destroy).each do |m|
eval %{
def #{m}

0 comments on commit 5d16059

Please sign in to comment.