Skip to content

Commit

Permalink
Abstract import_metadata method
Browse files Browse the repository at this point in the history
  • Loading branch information
radical-ube committed Aug 18, 2023
1 parent 064ed44 commit 233404a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/controllers/imports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def create

respond_to do |format|
if @import.save
@import.import_later(ActiveRecord::Type::Boolean.new.cast(params[:podcast_import][:import_metadata]))
@import.import_later(import_metadata)
format.html { redirect_to podcast_import_path(@podcast, @import), notice: t(".success") }
else
format.html do
Expand All @@ -55,4 +55,8 @@ def import_params
:url
)
end

def import_metadata
ActiveRecord::Type::Boolean.new.cast(params[:podcast_import][:import_metadata])
end
end
2 changes: 1 addition & 1 deletion app/models/podcast_import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class PodcastImport < ApplicationRecord

serialize :config, HashSerializer

attr_accessor :feed, :feed_raw_doc, :templates, :feed_source, :import_metadata
attr_accessor :feed, :feed_raw_doc, :templates, :feed_source

belongs_to :podcast, -> { with_deleted }, touch: true, optional: true, autosave: true
has_many :episode_imports, -> { where(has_duplicate_guid: false).includes(:podcast_import) }, dependent: :destroy
Expand Down

0 comments on commit 233404a

Please sign in to comment.