Class: Nuntius::SubscribersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Nuntius::SubscribersController
- Defined in:
- app/controllers/nuntius/subscribers_controller.rb
Instance Method Summary collapse
-
#show ⇒ Object
skip_before_action :authenticate_user!, only: %i[show destroy].
- #subscribe ⇒ Object
- #unsubscribe ⇒ Object
Instance Method Details
#show ⇒ Object
skip_before_action :authenticate_user!, only: %i[show destroy]
9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/nuntius/subscribers_controller.rb', line 9 def show @subscriber = Nuntius::Subscriber.find_by(id: params[:id]) if @subscriber @list = @subscriber.list else flash[:notice] = "Subscription not found." redirect_to root_path, status: :see_other end end |
#subscribe ⇒ Object
19 20 21 22 23 24 |
# File 'app/controllers/nuntius/subscribers_controller.rb', line 19 def subscribe @subscriber = Nuntius::Subscriber.find(params[:id]) @subscriber.update(unsubscribed_at: nil) flash[:notice] = "Subscription has been restored." redirect_to nuntius.subscriber_path(@subscriber), status: :see_other end |
#unsubscribe ⇒ Object
26 27 28 29 30 31 |
# File 'app/controllers/nuntius/subscribers_controller.rb', line 26 def unsubscribe @subscriber = Nuntius::Subscriber.find(params[:id]) @subscriber.touch(:unsubscribed_at) flash[:notice] = "Subscription has been removed." redirect_to nuntius.subscriber_path(@subscriber), status: :see_other end |