Sha256: 2fd2bbc57fbed8e71c9bfd3e2f37a72b837d5a4fd24d4bb444b512d075c8e346

Contents?: true

Size: 751 Bytes

Versions: 11

Compression:

Stored size: 751 Bytes

Contents

# frozen_string_literal: true

module MrCommon
  module Reminders
    class DownloadsController < BaseController
      skip_before_action MrCommon.authentication_method_name if MrCommon.authentication_method_name.present?
      skip_before_action :authorize_user if MrCommon.current_user_authorization_method_name.present?

      def show
        @reminder = Reminder.find_by(slug: params[:id])

        if @reminder.nil?
          render_not_found
        else
          send_data @reminder.to_ical,
                    disposition: "attachment; filename=#{ics_filename}",
                    content_type: "text/calendar"
        end
      end

      private

        def ics_filename
          "#{@reminder.slug}.ics"
        end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mr_common-2.1.0 app/controllers/mr_common/reminders/downloads_controller.rb
mr_common-2.0.0 app/controllers/mr_common/reminders/downloads_controller.rb
mr_common-1.3.0 app/controllers/mr_common/reminders/downloads_controller.rb
mr_common-1.2.0 app/controllers/mr_common/reminders/downloads_controller.rb
mr_common-1.1.0 app/controllers/mr_common/reminders/downloads_controller.rb
mr_common-1.0.5 app/controllers/mr_common/reminders/downloads_controller.rb
mr_common-1.0.4 app/controllers/mr_common/reminders/downloads_controller.rb
mr_common-1.0.3 app/controllers/mr_common/reminders/downloads_controller.rb
mr_common-1.0.2 app/controllers/mr_common/reminders/downloads_controller.rb
mr_common-1.0.1 app/controllers/mr_common/reminders/downloads_controller.rb
mr_common-1.0.0 app/controllers/mr_common/reminders/downloads_controller.rb