Class: CardController

Inherits:
ActionController::Base
  • Object
show all
Includes:
Recaptcha::Verify, Wagn::Location
Defined in:
app/controllers/card_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Wagn::Location

#discard_locations_for, #interrupted_action, #link_to_page, #location_history, #page_path, #previous_location, #save_interrupted_action, #save_location, #url_key_for_location, #wagn_path, #wagn_url

Instance Attribute Details

#cardObject (readonly)

Returns the value of attribute card.



23
24
25
# File 'app/controllers/card_controller.rb', line 23

def card
  @card
end

Instance Method Details

#assetObject



48
49
50
51
# File 'app/controllers/card_controller.rb', line 48

def asset
  Rails.logger.info "Routing assets through Wagn. Recommend symlink from Deck to Wagn gem using 'rake wagn:update_assets_symlink'"
  send_file_inside Wagn.paths['gem-assets'].existent.first, [ params[:filename], params[:format] ].join('.'), :x_sendfile => true
end

#createObject

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CORE METHODS


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

def create
  handle { card.save }
end

#deleteObject



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

def delete
  discard_locations_for card #should be an event
  params[:success] ||= 'REDIRECT: *previous'
  handle { card.delete }
end

#readObject



33
34
35
36
# File 'app/controllers/card_controller.rb', line 33

def read
  save_location # should be an event!
  show
end

#updateObject



38
39
40
# File 'app/controllers/card_controller.rb', line 38

def update
  card.new_card? ? create : handle { card.update_attributes params[:card] }
end