Class: Domakase::Record

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/domakase/record.rb

Overview

Configure domain models to follow domain-namespaced table naming conventions.

Given a domain model with the path app/domains/staff/models/user.rb, the table name will be staff_users.

This also extends to nested models. So if you have a domain model with the path app/domains/staff/models/user/session.rb, the table name will be staff_user_sessions.

If you would like to provide a custom name for your table instead, you can set your own table name in the domain definition like you normally would.

Class Method Summary collapse

Class Method Details

.table_nameObject



14
15
16
# File 'lib/domakase/record.rb', line 14

def self.table_name
  @table_name || model_name.plural
end

.table_name=(table_name) ⇒ Object



18
19
20
# File 'lib/domakase/record.rb', line 18

def self.table_name=(table_name)
  @table_name = table_name
end