Created
June 28, 2009 14:42
-
-
Save xHire/137289 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/activerecord-tableless.rb b/lib/activerecord-tableless.rb | |
index 83598c8..f865fed 100644 | |
--- a/lib/activerecord-tableless.rb | |
+++ b/lib/activerecord-tableless.rb | |
@@ -16,8 +16,10 @@ module ActiveRecord | |
# has_no_table | |
# | |
# column :name, :string | |
- # column :email, :string | |
- # column :message, :string | |
+ # | |
+ # # or | |
+ # | |
+ # addcol :string, :email, :message | |
# | |
# end | |
# | |
@@ -69,6 +71,13 @@ module ActiveRecord | |
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 new columns | |
+ def addcol type, *args | |
+ args.each do |col| | |
+ column col, type | |
+ end | |
+ end | |
%w(find create destroy).each do |m| | |
eval %{ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment