Class: Tomify::Api::Public::SubscriptionsController
- Inherits:
-
Object
- Object
- Tomify::Api::Public::SubscriptionsController
- Defined in:
- app/controllers/tomify/api/public/subscriptions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'app/controllers/tomify/api/public/subscriptions_controller.rb', line 2 def create record.activities.create(action: action_name, controller: controller_name) if record.update(active: true) render json: { type: :success, data: data, message: "You have been subscribed to #{setting(:name)}" } else render json: { type: :warning, message: "There was a problem subscribing you to #{setting(:name)}" } end end |
#destroy ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/controllers/tomify/api/public/subscriptions_controller.rb', line 11 def destroy record.activities.create(action: action_name, controller: controller_name) if record.update(active: false) render json: { type: :success, data: data, message: "You have been unsubscribed from #{setting(:name)}" } else render json: { type: :warning, message: "There was a problem unsubscribing you from #{setting(:name)}" } end end |