Class: Hecks::Adapters::SQLDatabase::Commands::Create
- Inherits:
-
Object
- Object
- Hecks::Adapters::SQLDatabase::Commands::Create
- Defined in:
- lib/commands/create.rb,
lib/commands/create/add_to_join_tables.rb,
lib/commands/create/find_or_create_references.rb
Defined Under Namespace
Classes: AddToJoinTables, FindOrCreateReferences
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(attributes:, head:) ⇒ Create
constructor
A new instance of Create.
Constructor Details
#initialize(attributes:, head:) ⇒ Create
Returns a new instance of Create.
11 12 13 14 15 16 17 |
# File 'lib/commands/create.rb', line 11 def initialize(attributes:, head:) @attributes = attributes.clone @reference_ids = {} @head = head @references = @head.references @table = Table.factory([@head]).first end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/commands/create.rb', line 9 def id @id end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/commands/create.rb', line 19 def call DB.transaction do find_or_create_references create add_to_join_tables end self end |