Class: TransactionPage

Inherits:
Page
  • Object
show all
Defined in:
lib/models/transaction_page.rb

Instance Method Summary collapse

Instance Method Details

#cartObject

TODO: find way to abstract this



4
5
6
7
8
9
10
11
# File 'lib/models/transaction_page.rb', line 4

def cart
  if logged_in?
    @cart ||= site.carts.where(transaction: nil, user: current_user.id).order('created desc').first
  else
    # TODO: need to track by session
    nil
  end
end

#productsObject



17
18
19
# File 'lib/models/transaction_page.rb', line 17

def products
  cart.product_holds.collect(&:product)
end

#successful?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/models/transaction_page.rb', line 13

def successful?
  @successful
end