Class: Renalware::Letters::Mailshots::MailshotsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::Letters::Mailshots::MailshotsController
- Includes:
- Pagy::Backend
- Defined in:
- app/controllers/renalware/letters/mailshots/mailshots_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/renalware/letters/mailshots/mailshots_controller.rb', line 23 def create mailshot = Mailshot.new(mailshot_params) mailshot, :create? mailshot.letters_count = mailshot.recipient_patients.length mailshot.status = "queued" if mailshot.save_by(current_user) CreateMailshotLettersJob.perform_later(mailshot) redirect_to letters_mailshots_path, notice: "Mailshot queued for background processing" else render_new(mailshot) end end |
#index ⇒ Object
11 12 13 14 15 |
# File 'app/controllers/renalware/letters/mailshots/mailshots_controller.rb', line 11 def index pagy, mailshots = pagy(Mailshot.includes(:author).order(created_at: :desc)) mailshots render locals: { mailshots: mailshots, pagy: pagy } end |
#new ⇒ Object
17 18 19 20 21 |
# File 'app/controllers/renalware/letters/mailshots/mailshots_controller.rb', line 17 def new mailshot = Mailshot.new mailshot render_new(mailshot) end |