Class: PgRest::PgTable

Inherits:
ApplicationRecord show all
Includes:
PgSearch::Model
Defined in:
app/models/pg_rest/pg_table.rb

Class Method Summary collapse

Class Method Details

.modelize(table_name) ⇒ Object



7
8
9
10
11
12
13
14
# File 'app/models/pg_rest/pg_table.rb', line 7

def self.modelize(table_name) 
  class_name = table_name.singularize.capitalize
  if Object.const_defined? class_name
    class_name.constantize
  else 
    Object.const_set class_name, Class.new(PgRest::PgTable)
  end 
end