From 2586fba3b8a181289c597071733774b3a406f675 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 6 Jul 2018 15:42:33 -0400 Subject: Abstracted Recordable concern Blogs, streams, and updates are all recordable, and there's no need to repeat code in the models for this. --- app/models/concerns/recordable.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 app/models/concerns/recordable.rb (limited to 'app/models/concerns') diff --git a/app/models/concerns/recordable.rb b/app/models/concerns/recordable.rb new file mode 100644 index 0000000..bbbb582 --- /dev/null +++ b/app/models/concerns/recordable.rb @@ -0,0 +1,9 @@ +module Recordable + extend ActiveSupport::Concern + + included do + has_many :records, as: :recordable, inverse_of: :recordable + + accepts_nested_attributes_for :records, allow_destroy: true + end +end -- cgit 1.4.1