docbrown/app/controllers/admin/podcasts_controller.rb
Anna Buianova fabaeb5461 Introduced published field to podcasts (#3593)
* Published field for podcasts

* Add podcasts migration

* More specs for podcasts availability

* Show published in podcasts internal

* Update schema.rb with db:migrate
2019-08-01 09:29:13 -04:00

20 lines
563 B
Ruby

module Admin
class PodcastsController < Admin::ApplicationController
def create
resource = resource_class.new(resource_params)
authorize_resource(resource)
if resource.save
Podcasts::GetEpisodesJob.perform_later(podcast_id: resource.id) if resource.published
redirect_to(
[namespace, resource],
notice: translate_with_resource("create.success"),
)
else
render :new, locals: {
page: Administrate::Page::Form.new(dashboard, resource)
}
end
end
end
end