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

POST /subscribers POST /subscribers.json



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

def create
  @subscriber = Subscriber.new(params[:subscriber])

  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



75
76
77
78
79
80
81
82
83
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 75

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

#editObject

GET /subscribers/1/edit



37
38
39
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 37

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

#indexObject

GET /subscribers GET /subscribers.json



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

def index
  @subscribers = Subscriber.all

  respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @subscribers }
  end
end

#newObject

GET /subscribers/new GET /subscribers/new.json



27
28
29
30
31
32
33
34
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 27

def new
  @subscriber = Subscriber.new

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

#showObject

GET /subscribers/1 GET /subscribers/1.json



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

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

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

#updateObject

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



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 59

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

  respond_to do |format|
    if @subscriber.update_attributes(params[:subscriber])
      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