class DbDumper::QueryBuilder::Table
Storage for generated classes inherited from ActiveRecord::Base
Attributes
table_name[R]
Public Class Methods
from(raw_table)
click to toggle source
# File lib/db_dumper/query_builder/table.rb, line 13 def self.from(raw_table) return raw_table if raw_table.is_a?(Table) table_name_str = raw_table.to_s @tables[table_name_str] ||= new(table_name_str) end
new(table_name)
click to toggle source
# File lib/db_dumper/query_builder/table.rb, line 28 def initialize(table_name) @table_name = table_name create_table end
Public Instance Methods
ar()
click to toggle source
# File lib/db_dumper/query_builder/table.rb, line 20 def ar @ar ||= Class.new(ActiveRecord::Base).tap do |klass| klass.table_name = table_name end end
Private Instance Methods
create_table()
click to toggle source
# File lib/db_dumper/query_builder/table.rb, line 33 def create_table ActiveRecord::Migration.create_table(table_name) end