Class: BitCore::Tool
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- BitCore::Tool
- Defined in:
- app/models/bit_core/tool.rb
Overview
A section of an application.
Instance Method Summary collapse
Instance Method Details
#add_module(title_or_module) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/models/bit_core/tool.rb', line 15 def add_module(title_or_module) if title_or_module.class == String content_modules.build(title: title_or_module, position: next_position) else title_or_module.tap do |m| m.tool = self m.position = next_position end end end |
#last_position ⇒ Object
26 27 28 |
# File 'app/models/bit_core/tool.rb', line 26 def last_position content_modules.order(:position).last.try(:position) || 0 end |