Class: Helpdesk::Admin::SubscribersController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Helpdesk::Admin::SubscribersController
- Defined in:
- app/controllers/helpdesk/admin/subscribers_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#destroy ⇒ Object
DELETE /subscribers/1 DELETE /subscribers/1.json.
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
-
#update ⇒ Object
PUT /subscribers/1 PUT /subscribers/1.json.
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/controllers/helpdesk/admin/subscribers_controller.rb', line 11 def create @subscriber = Helpdesk::Subscriber.new(params[:subscriber]) if @subscriber.save redirect_to admin_subscribers_path, notice: t('subscribers.created') else render action: "index" end end |
#destroy ⇒ Object
DELETE /subscribers/1 DELETE /subscribers/1.json
38 39 40 41 42 |
# File 'app/controllers/helpdesk/admin/subscribers_controller.rb', line 38 def destroy @subscriber = Helpdesk::Subscriber.find_by_hashcode(params[:hashcode]) @subscriber.destroy redirect_to root_path end |
#edit ⇒ Object
20 21 22 |
# File 'app/controllers/helpdesk/admin/subscribers_controller.rb', line 20 def edit @subscriber = Helpdesk::Subscriber.find(params[:id]) end |
#index ⇒ Object
3 4 5 |
# File 'app/controllers/helpdesk/admin/subscribers_controller.rb', line 3 def index @subscribers = Helpdesk::Subscriber.page(params[:page]) end |
#new ⇒ Object
7 8 9 |
# File 'app/controllers/helpdesk/admin/subscribers_controller.rb', line 7 def new @subscriber = Helpdesk::Subscriber.new() end |
#update ⇒ Object
PUT /subscribers/1 PUT /subscribers/1.json
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/helpdesk/admin/subscribers_controller.rb', line 26 def update @subscriber = Helpdesk::Subscriber.find(params[:id]) if @subscriber.update_attributes(params[:subscriber]) redirect_to admin_subscribers_path, notice: 'Subscriber was successfully updated.' else render action: "edit" end end |