Class: HasVcards::VcardsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/has_vcards/vcards_controller.rb

Instance Method Summary collapse

Instance Method Details

#directory_lookupObject



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

def directory_lookup
  @vcard = Vcard.find(params[:id])
end

#directory_updateObject



11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/has_vcards/vcards_controller.rb', line 11

def directory_update
  @vcard = Vcard.find(params[:id])
  new_params = params[:vcard].select { |key, _| ['family_name', 'given_name', 'street_address', 'postal_code', 'locality'].include?(key) }

  @vcard.update_attributes(new_params)

  @vcard.save

  redirect_to @vcard.reference
end