Class: Lit::SourcesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/lit/sources_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



33
34
35
36
37
38
39
40
# File 'app/controllers/lit/sources_controller.rb', line 33

def create
  @source = Source.new(clear_params)
  if @source.save
    redirect_to @source, :notice => 'Source was successfully created.'
  else
    render :action => "new"
  end
end

#destroyObject



51
52
53
54
55
# File 'app/controllers/lit/sources_controller.rb', line 51

def destroy
  @source = Source.find(params[:id])
  @source.destroy
  redirect_to sources_url
end

#editObject



17
18
19
# File 'app/controllers/lit/sources_controller.rb', line 17

def edit
  @source = Source.find(params[:id])
end

#indexObject



5
6
7
# File 'app/controllers/lit/sources_controller.rb', line 5

def index
  @sources = Source.all
end

#newObject



13
14
15
# File 'app/controllers/lit/sources_controller.rb', line 13

def new
  @source = Source.new
end

#showObject



9
10
11
# File 'app/controllers/lit/sources_controller.rb', line 9

def show
  @source = Source.find(params[:id])
end

#synchronizeObject



21
22
23
24
25
# File 'app/controllers/lit/sources_controller.rb', line 21

def synchronize
  @source = Source.find(params[:id])
  @source.synchronize
  redirect_to lit.source_incomming_localizations_path(@source)
end

#touchObject



27
28
29
30
31
# File 'app/controllers/lit/sources_controller.rb', line 27

def touch
  @source = Source.find(params[:id])
  @source.touch_last_updated_at!
  redirect_to request.env["HTTP_REFERER"].present? ? :back : @source
end

#updateObject



42
43
44
45
46
47
48
49
# File 'app/controllers/lit/sources_controller.rb', line 42

def update
  @source = Source.find(params[:id])
  if @source.update_attributes(clear_params)
    redirect_to @source, :notice => 'Source was successfully updated.'
  else
    render :action => "edit"
  end
end