Module: ActiveRecord::Tableless::ActsMethods
- Defined in:
- lib/activerecord-tableless.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#has_no_table(options = {:database => :fail_fast}) ⇒ Object
A model that needs to be tableless will call this method to indicate it.
- #tableless? ⇒ Boolean
Instance Method Details
#has_no_table(options = {:database => :fail_fast}) ⇒ Object
A model that needs to be tableless will call this method to indicate it.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/activerecord-tableless.rb', line 45 def has_no_table( = {:database => :fail_fast}) raise ArgumentError.new("Invalid database option '#{options[:database]}'") unless [:fail_fast, :pretend_success].member? [:database] # keep our options handy if ActiveRecord::VERSION::STRING < "3.1.0" write_inheritable_attribute(:tableless_options, { :database => [:database], :columns => [] } ) class_inheritable_reader :tableless_options elsif ActiveRecord::VERSION::STRING >= "3.2.0" class_attribute :tableless_options self. = { :database => [:database], :columns => [] } else raise Exception.new("Sorry, ActiveRecord version #{ActiveRecord::VERSION::STRING} is not supported") end # extend extend ActiveRecord::Tableless::SingletonMethods extend ActiveRecord::Tableless::ClassMethods # include include ActiveRecord::Tableless::InstanceMethods # setup columns end |
#tableless? ⇒ Boolean
75 76 77 |
# File 'lib/activerecord-tableless.rb', line 75 def tableless? false end |