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

#createObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 15

def create
  @subscriber = Subscriber.new(subscriber_params)

  respond_to do |format|
    if @subscriber.save
      format.html { redirect_to @subscriber, notice: 'Subscriber was successfully created.' }
      format.json { render json: @subscriber, status: :created, location: @subscriber }
    else
      format.html { render action: "new" }
      format.json { render json: @subscriber.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /subscribers/1 DELETE /subscribers/1.json



32
33
34
35
36
37
38
39
40
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 32

def destroy
  @subscriber = Subscriber.find(params[:id])
  @subscriber.destroy

  respond_to do |format|
    format.html { redirect_to subscribers_url }
    format.json { head :no_content }
  end
end

#indexObject



5
6
7
8
9
10
11
12
13
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 5

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

  respond_to do |format|
    format.html # new.html.erb
    format.json { render json: @subscriber }
  end
end