Class: Hecks::Adapters::SQLDatabase::JoinTable
- Inherits:
-
Object
- Object
- Hecks::Adapters::SQLDatabase::JoinTable
- Defined in:
- lib/join_table.rb
Instance Method Summary collapse
- #columns ⇒ Object
-
#initialize(table, column) ⇒ JoinTable
constructor
A new instance of JoinTable.
- #name ⇒ Object
Constructor Details
#initialize(table, column) ⇒ JoinTable
Returns a new instance of JoinTable.
5 6 7 8 |
# File 'lib/join_table.rb', line 5 def initialize(table, column) @table = table @column = column end |
Instance Method Details
#columns ⇒ Object
14 15 16 17 18 |
# File 'lib/join_table.rb', line 14 def columns [@table.name, @column.name].map do |name| Column.new(name: name.singularize + '_id', type: 'Integer') end end |
#name ⇒ Object
10 11 12 |
# File 'lib/join_table.rb', line 10 def name "#{@table.name}_#{@column.name}" end |