Class: Ems::ChannelsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ems/channels_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_ability

Instance Method Details

#createObject

POST /channels POST /channels.json



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/controllers/ems/channels_controller.rb', line 44

def create
  @channel = Channel.new(params[:channel])
  
  respond_to do |format|
    if @channel.save
      format.html { redirect_to @channel, notice: 'Channel was successfully created.' }
      format.json { render json: @channel, status: :created, location: @channel }
    else
      format.html { render action: "new" }
      format.json { render json: @channel.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /channels/1 DELETE /channels/1.json



76
77
78
79
80
81
82
83
84
# File 'app/controllers/ems/channels_controller.rb', line 76

def destroy
  @channel = Channel.find(params[:id])
  @channel.destroy
  
  respond_to do |format|
    format.html { redirect_to channels_url }
    format.json { head :no_content }
  end
end

#editObject

GET /channels/1/edit



38
39
40
# File 'app/controllers/ems/channels_controller.rb', line 38

def edit
  @channel = Channel.find(params[:id])
end

#indexObject

GET /channels GET /channels.json



6
7
8
9
10
11
12
13
# File 'app/controllers/ems/channels_controller.rb', line 6

def index
  @channels = Channel.all

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

#newObject

GET /channels/new GET /channels/new.json



28
29
30
31
32
33
34
35
# File 'app/controllers/ems/channels_controller.rb', line 28

def new
  @channel = Channel.new
  
  respond_to do |format|
    format.html # new.html.erb
    format.json { render json: @channel }
  end
end

#showObject

GET /channels/1 GET /channels/1.json



17
18
19
20
21
22
23
24
# File 'app/controllers/ems/channels_controller.rb', line 17

def show
  @channel = Channel.find(params[:id])
  
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @channel }
  end
end

#updateObject

PUT /channels/1 PUT /channels/1.json



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'app/controllers/ems/channels_controller.rb', line 60

def update
  @channel = Channel.find(params[:id])
  
  respond_to do |format|
    if @channel.update_attributes(params[:channel])
      format.html { redirect_to @channel, notice: 'Channel was successfully updated.' }
      format.json { head :no_content }
    else
      format.html { render action: "edit" }
      format.json { render json: @channel.errors, status: :unprocessable_entity }
    end
  end
end