Module: VisitCard::Controllers::VcardsController::InstanceMethods

Defined in:
lib/visit_card/controllers/vcards_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



33
34
35
36
37
# File 'lib/visit_card/controllers/vcards_controller.rb', line 33

def create
  @vcard ||= Vcard.new(params[:vcard])
  build_relations unless @vcard.save
  respond_with(@vcard)
end

#destroyObject



45
46
47
48
49
# File 'lib/visit_card/controllers/vcards_controller.rb', line 45

def destroy
  @vcard ||= Vcard.find(params[:id])
  @vcard.destroy
  respond_with(@vcard)
end

#editObject



27
28
29
30
31
# File 'lib/visit_card/controllers/vcards_controller.rb', line 27

def edit
  @vcard ||= Vcard.find(params[:id])
  build_relations
  respond_with(@vcard)
end

#indexObject



11
12
13
14
# File 'lib/visit_card/controllers/vcards_controller.rb', line 11

def index
  @vcards ||= Vcard.all
  respond_with(@vcards)
end

#newObject



21
22
23
24
25
# File 'lib/visit_card/controllers/vcards_controller.rb', line 21

def new
  @vcard ||= Vcard.new
  build_relations
  respond_with(@vcard)
end

#showObject



16
17
18
19
# File 'lib/visit_card/controllers/vcards_controller.rb', line 16

def show
  @vcard ||= Vcard.find(params[:id])
  respond_with(@vcards)
end

#updateObject



39
40
41
42
43
# File 'lib/visit_card/controllers/vcards_controller.rb', line 39

def update
  @vcard ||= Vcard.find(params[:id])
  build_relations unless @vcard.update_attributes(params[:vcard])
  respond_with(@vcard)
end