Class: CardTypesController

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

Instance Method Summary collapse

Methods included from ApplicationHelper

#footer_menu, #home_page, #page_title

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
# File 'app/controllers/card_types_controller.rb', line 19

def create
  @card_type = CardType.new(params[:card_type])
  if @card_type.save
    flash[:notice] = 'CardType was successfully created.'
    redirect_to :action => 'list'
  else
    render :action => 'new'
  end
end

#destroyObject



43
44
45
46
# File 'app/controllers/card_types_controller.rb', line 43

def destroy
  CardType.find(params[:id]).destroy
  redirect_to :action => 'list'
end

#editObject



29
30
31
# File 'app/controllers/card_types_controller.rb', line 29

def edit
  @card_type = CardType.find(params[:id])
end

#indexObject



2
3
4
5
# File 'app/controllers/card_types_controller.rb', line 2

def index
  list
  render :action => 'list'
end

#listObject



7
8
9
# File 'app/controllers/card_types_controller.rb', line 7

def list
  @card_type_pages, @card_types = paginate :card_types, :per_page => 10
end

#newObject



15
16
17
# File 'app/controllers/card_types_controller.rb', line 15

def new
  @card_type = CardType.new
end

#showObject



11
12
13
# File 'app/controllers/card_types_controller.rb', line 11

def show
  @card_type = CardType.find(params[:id])
end

#updateObject



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

def update
  @card_type = CardType.find(params[:id])
  if @card_type.update_attributes(params[:card_type])
    flash[:notice] = 'CardType was successfully updated.'
    redirect_to :action => 'show', :id => @card_type
  else
    render :action => 'edit'
  end
end