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



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

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



46
47
48
49
50
51
52
53
54
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 46

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

#newObject



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

def new
  @subscriber = Subscriber.new

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

#updateObject

PUT /subscribers/1 PUT /subscribers/1.json



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

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

  respond_to do |format|
    if @subscriber.update_attributes(subscriber_params)
      format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }
      format.json { head :no_content }
    else
      format.html { render action: "edit" }
      format.json { render json: @subscriber.errors, status: :unprocessable_entity }
    end
  end
end