Class: Lcms::Engine::GenerateHierarchicalPositions
- Inherits:
-
Object
- Object
- Lcms::Engine::GenerateHierarchicalPositions
- Defined in:
- app/services/lcms/engine/generate_hierarchical_positions.rb
Instance Method Summary collapse
- #generate! ⇒ Object
-
#initialize(queryset = nil) ⇒ GenerateHierarchicalPositions
constructor
A new instance of GenerateHierarchicalPositions.
Constructor Details
#initialize(queryset = nil) ⇒ GenerateHierarchicalPositions
Returns a new instance of GenerateHierarchicalPositions.
6 7 8 |
# File 'app/services/lcms/engine/generate_hierarchical_positions.rb', line 6 def initialize(queryset = nil) @queryset = queryset || Resource.all end |
Instance Method Details
#generate! ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/services/lcms/engine/generate_hierarchical_positions.rb', line 10 def generate! puts "====> Generating Resource hierarchical positions\n" @queryset.each do |res| # obs: were we want a simple sql update statement, without rails callbacks res.update_columns hierarchical_position: HierarchicalPosition.new(res).position print '.' end puts "\n" end |