Module: Outpost::Controller::Actions

Defined in:
lib/outpost/controller/actions.rb

Instance Method Summary collapse

Instance Method Details

#createObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/outpost/controller/actions.rb', line 29

def create
  @record = model.new(form_params)

  if @record.save
    notice "Saved #{@record.simple_title}"
    respond_with :outpost, @record, location: requested_location
  else
    breadcrumb "New"
    render :new
  end
end

#destroyObject



51
52
53
54
55
# File 'lib/outpost/controller/actions.rb', line 51

def destroy
  @record.destroy
  notice "Deleted #{@record.simple_title}"
  respond_with :outpost, @record
end

#editObject



24
25
26
27
# File 'lib/outpost/controller/actions.rb', line 24

def edit
  breadcrumb "Edit", nil, @record.to_title
  respond_with :outpost, @record
end

#indexObject



10
11
12
# File 'lib/outpost/controller/actions.rb', line 10

def index
  respond_with :outpost, @records
end

#newObject



14
15
16
17
18
# File 'lib/outpost/controller/actions.rb', line 14

def new
  breadcrumb "New"
  @record = model.new
  respond_with :outpost, @record
end

#showObject



20
21
22
# File 'lib/outpost/controller/actions.rb', line 20

def show
  redirect_to @record.admin_edit_path
end

#updateObject



41
42
43
44
45
46
47
48
49
# File 'lib/outpost/controller/actions.rb', line 41

def update
  if @record.update_attributes(form_params)
    notice "Saved #{@record.simple_title}"
    respond_with :outpost, @record, location: requested_location
  else
    breadcrumb "Edit", nil, @record.to_title
    render :edit
  end
end