Class: Commontator::SubscriptionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Commontator::SubscriptionsController
- Defined in:
- app/controllers/commontator/subscriptions_controller.rb
Instance Method Summary collapse
-
#subscribe ⇒ Object
PUT /threads/1/subscribe.
-
#unsubscribe ⇒ Object
PUT /threads/1/unsubscribe.
Instance Method Details
#subscribe ⇒ Object
PUT /threads/1/subscribe
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/commontator/subscriptions_controller.rb', line 5 def subscribe security_transgression_unless @commontator_thread.can_subscribe?(@commontator_user) @commontator_thread.errors.add(:base, t('commontator.subscription.errors.already_subscribed')) \ unless @commontator_thread.subscribe(@commontator_user) respond_to do |format| format.html { redirect_to commontable_url } format.js { render :subscribe } end end |
#unsubscribe ⇒ Object
PUT /threads/1/unsubscribe
19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/commontator/subscriptions_controller.rb', line 19 def unsubscribe security_transgression_unless @commontator_thread.can_subscribe?(@commontator_user) @commontator_thread.errors.add(:base, t('commontator.subscription.errors.not_subscribed')) \ unless @commontator_thread.unsubscribe(@commontator_user) respond_to do |format| format.html { redirect_to commontable_url } format.js { render :subscribe } end end |