Module: Undestroyable::Orm::ActiveRecord::Database

Defined in:
lib/undestroyable/orm/active_record/database.rb

Overview

:database strategy will save any deleted record within remote database. :connection option *is required*. By default, it will use same naming as a actual table. In order to change the table name, following options can be specified within configuration:

[:table_name]
  Keep alternative to table name. By default it will equivalent to one used by Model backend.
[:table_prefix]
  Keep table prefix. If it is set not nil, it will be ignored for table creation. Default is nil.
[:table_suffix]
  Keep table suffix. If it is set not nil, it will be ignored for table creation. Default is nil.
[:full_table_name]
  Keep full table name. If this field is not specified it will be generated from
  table_name + table_prefix + table_suffix.

Example

class ConceptCat < ActiveRecord::Base
  undstroyable do
    startegy :database
    connection { adapter: "sqlite3", dbfile: ":memory:"}
    table_name :scrap
    table_suffix :metalic
  end
end

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



31
32
33
34
35
# File 'lib/undestroyable/orm/active_record/database.rb', line 31

def self.included(base)
  base.send :include, Table
  base.send :include, InstanceMethods
  base.extend ClassMethods
end