Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Stubbed some database methods

  • Loading branch information...
commit 2687b2d3f7a5a3cebdbc5e649ee9cba888b222bd 1 parent 9a6b527
@wagenet wagenet authored
Showing with 25 additions and 0 deletions.
  1. +25 −0 lib/tableless.rb
View
25 lib/tableless.rb
@@ -48,6 +48,9 @@ def has_no_table
# extend
extend ActiveRecord::Tableless::SingletonMethods
+ # include
+ include ActiveRecord::Tableless::InstanceMethods
+
# setup columns
end
@@ -66,6 +69,28 @@ 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
+ %w(find create destroy).each do |m|
+ eval %{
+ def #{m}
+ logger.warn "Can't #{m} a Tableless object"
+ false
+ end
+ }
+ end
+
+ end
+
+ module InstanceMethods
+
+ %w(save destroy).each do |m|
+ eval %{
+ def #{m}
+ logger.warn "Can't #{m} a Tableless object"
+ false
+ end
+ }
+ end
+
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.