Class: RailsSpider::WorksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/the_spider/works_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/the_spider/works_controller.rb', line 17

def create
  @work = Work.new(work_params)

  if @work.save
    redirect_to @work, notice: 'Work was successfully created.'
  else
    render :new
  end
end

#destroyObject



46
47
48
49
# File 'app/controllers/the_spider/works_controller.rb', line 46

def destroy
  @work.destroy
  redirect_to works_url, notice: 'Work was successfully destroyed.'
end

#editObject



27
28
# File 'app/controllers/the_spider/works_controller.rb', line 27

def edit
end

#indexObject



6
7
8
# File 'app/controllers/the_spider/works_controller.rb', line 6

def index
  @works = Work.page(params[:page])
end

#newObject



13
14
15
# File 'app/controllers/the_spider/works_controller.rb', line 13

def new
  @work = Work.new
end

#parserObject



42
43
44
# File 'app/controllers/the_spider/works_controller.rb', line 42

def parser
  ParserJob.perform_later(@work.id)
end

#runObject



38
39
40
# File 'app/controllers/the_spider/works_controller.rb', line 38

def run
  WorkJob.perform_later(@work.id)
end

#showObject



10
11
# File 'app/controllers/the_spider/works_controller.rb', line 10

def show
end

#updateObject



30
31
32
33
34
35
36
# File 'app/controllers/the_spider/works_controller.rb', line 30

def update
  if @work.update(work_params)
    redirect_to @work, notice: 'Work was successfully updated.'
  else
    render :edit
  end
end