Class: Noodnik::NagsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Noodnik::NagsController
- Defined in:
- app/controllers/noodnik/nags_controller.rb
Instance Method Summary collapse
Instance Method Details
#complete ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/noodnik/nags_controller.rb', line 18 def complete topic = params[:topic] if user_id.present? nag = find_or_create_nag(topic) nag.completed = true nag.save else .delete "noodnik_#{topic}" end render :nothing => true end |
#postpone ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/noodnik/nags_controller.rb', line 3 def postpone next_nag = params[:period].to_i.from_now topic = params[:topic] if user_id.present? find_or_create_nag(topic).tap do |nag| nag.next_nag = next_nag end.save else ["noodnik_#{topic}"] = next_nag.to_s end render :nothing => true end |