app/models/spina/structure_item.rb in spina-0.6.15 vs app/models/spina/structure_item.rb in spina-0.6.16
- old
+ new
@@ -4,7 +4,12 @@
has_many :structure_parts, dependent: :destroy
scope :sorted_by_structure, -> { order('position') }
accepts_nested_attributes_for :structure_parts, allow_destroy: true
+
+ def content(structure_part)
+ structure_part = structure_parts.where(name: structure_part).first
+ structure_part.try(:content)
+ end
end
end
\ No newline at end of file