Class: Payable::WelcomeController

Inherits:
ApplicationController show all
Defined in:
app/controllers/payable/welcome_controller.rb

Instance Method Summary collapse

Instance Method Details

#checkoutObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/payable/welcome_controller.rb', line 8

def checkout
  @order = Order.find(params[:id])

  begin
    @order.checkout_bill
    redirect_to :controller => "welcome", :action => "json_form", :id => @order.id
  rescue
    flash[:error] = $!.message
    redirect_to root_url
  end
end

#indexObject



3
4
5
6
# File 'app/controllers/payable/welcome_controller.rb', line 3

def index
  Order.create(:value => rand(100) * 1.234, :bill_status => 'open') if Order.open.size.zero?
  @orders = Order.order('id DESC').all
end

#json_formObject



20
21
22
# File 'app/controllers/payable/welcome_controller.rb', line 20

def json_form
  @order = Order.find(params[:id])
end