Module: VisitCard::Controllers::VcardsController::InstanceMethods
- Defined in:
- lib/visit_card/controllers/vcards_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#edit ⇒ Object
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 |
#index ⇒ Object
11 12 13 14 |
# File 'lib/visit_card/controllers/vcards_controller.rb', line 11 def index @vcards ||= Vcard.all respond_with(@vcards) end |
#new ⇒ Object
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 |
#show ⇒ Object
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 |
#update ⇒ Object
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 |