Class: Helpdesk::SubscribersController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#default_url_options, #ensure_user

Instance Method Details

#activationObject



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

def activation
  @subscriber = Subscriber.where(hashcode:params[:hashcode],confirmed:false).first
  @subscriber.update_attributes(hashcode:nil,confirmed:true) if @subscriber
  redirect_to root_path,notice: 'Subscriber was successfully activated.'
end

#createObject



9
10
11
12
13
14
15
16
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 9

def create
  @subscriber = Subscriber.new(subscriber_params)
  if @subscriber.save
    redirect_to root_path, notice: 'Subscriber was successfully created.'
  else
    render action: "index"
  end
end

#destroyObject



24
25
26
27
28
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 24

def destroy
  @subscriber = Subscriber.where(hashcode:params[:hashcode],confirmed:true).first
  @subscriber.destroy if @subscriber
  redirect_to root_path,notice: 'Subscriber was successfully deleted.'
end

#indexObject



4
5
6
7
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 4

def index
  @subscriber = Subscriber.new
  @subscriber.lang = locale
end