Class: Docent::LinksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/docent/links_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
# File 'app/controllers/docent/links_controller.rb', line 18

def create
  @link = Link.new(params[:link])

  if @link.save
    redirect_to links_url, notice: 'Successfully created link.'
  else
    render action: "new"
  end
end

#destroyObject



38
39
40
41
42
43
# File 'app/controllers/docent/links_controller.rb', line 38

def destroy
  @link = Link.find(params[:id])
  @link.destroy

  redirect_to links_url, notice: 'Successfully deleted link.'
end

#editObject



14
15
16
# File 'app/controllers/docent/links_controller.rb', line 14

def edit
  @link = Link.find(params[:id])
end

#indexObject



6
7
8
# File 'app/controllers/docent/links_controller.rb', line 6

def index
  @links = Link.all
end

#newObject



10
11
12
# File 'app/controllers/docent/links_controller.rb', line 10

def new
  @link = Link.new
end

#updateObject



28
29
30
31
32
33
34
35
36
# File 'app/controllers/docent/links_controller.rb', line 28

def update
  @link = Link.find(params[:id])

  if @link.update_attributes(params[:link])
    redirect_to links_url, notice: 'Successfully updated link.'
  else
    render action: "edit"
  end
end