Class: Helpdesk::Admin::SubscribersController

Inherits:
BaseController show all
Defined in:
app/controllers/helpdesk/admin/subscribers_controller.rb

Instance Method Summary collapse

Methods inherited from Helpdesk::ApplicationController

#default_url_options, #ensure_user

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
# File 'app/controllers/helpdesk/admin/subscribers_controller.rb', line 11

def create
  @subscriber = Helpdesk::Subscriber.new(subscriber_params)
  if @subscriber.save
    redirect_to admin_subscribers_path, notice: t('subscribers.created')
  else
    render action: "index"
  end
end

#destroyObject

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

#editObject



20
21
22
# File 'app/controllers/helpdesk/admin/subscribers_controller.rb', line 20

def edit
  @subscriber = Helpdesk::Subscriber.find(params[:id])
end

#indexObject



3
4
5
# File 'app/controllers/helpdesk/admin/subscribers_controller.rb', line 3

def index
  @subscribers = Helpdesk::Subscriber.page(params[:page])
end

#newObject



7
8
9
# File 'app/controllers/helpdesk/admin/subscribers_controller.rb', line 7

def new
  @subscriber = Helpdesk::Subscriber.new()
end

#updateObject

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(subscriber_params)
    redirect_to admin_subscribers_path, notice: 'Subscriber was successfully updated.'
  else
    render action: "edit"
  end
end