Class: TableSaw::DependencyGraph::BelongsToDirectives
- Inherits:
-
Object
- Object
- TableSaw::DependencyGraph::BelongsToDirectives
- Defined in:
- lib/table_saw/dependency_graph/belongs_to_directives.rb
Constant Summary collapse
- QUERY =
<<~SQL select distinct %{column} from %{table_name} where %{clause} and %{column} is not null and %{polymorphic} SQL
Instance Attribute Summary collapse
-
#directive ⇒ Object
readonly
Returns the value of attribute directive.
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(manifest, directive) ⇒ BelongsToDirectives
constructor
A new instance of BelongsToDirectives.
Constructor Details
#initialize(manifest, directive) ⇒ BelongsToDirectives
Returns a new instance of BelongsToDirectives.
12 13 14 15 |
# File 'lib/table_saw/dependency_graph/belongs_to_directives.rb', line 12 def initialize(manifest, directive) @manifest = manifest @directive = directive end |
Instance Attribute Details
#directive ⇒ Object (readonly)
Returns the value of attribute directive.
10 11 12 |
# File 'lib/table_saw/dependency_graph/belongs_to_directives.rb', line 10 def directive @directive end |
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
10 11 12 |
# File 'lib/table_saw/dependency_graph/belongs_to_directives.rb', line 10 def manifest @manifest end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 |
# File 'lib/table_saw/dependency_graph/belongs_to_directives.rb', line 17 def call associations.map do |fk| TableSaw::DependencyGraph::AddDirective.new(fk.to_table, ids: ids[fk.column.primary_key], partial: directive.partial?) end end |