Module: Reorm::ClassDatabaseSettings

Defined in:
lib/reorm/modules/database_modules.rb

Constant Summary collapse

@@class_db_settings =
{}

Instance Method Summary collapse

Instance Method Details

#assign_table_defaultsObject



9
10
11
12
# File 'lib/reorm/modules/database_modules.rb', line 9

def assign_table_defaults
  @@class_db_settings[self] = {primary_key: :id,
                               table_name:  self.name.split("::").last.tableize}
end

#table_settingsObject



14
15
16
17
# File 'lib/reorm/modules/database_modules.rb', line 14

def table_settings
  assign_table_defaults if !@@class_db_settings.include?(self)
  @@class_db_settings[self]
end