Class: OrdersController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#get_login_link, #set_locale_with_config

Instance Method Details

#indexObject



5
6
7
# File 'app/controllers/orders_controller.rb', line 5

def index
  @orders = current_user.orders(:conditions => {:status => ['paid', 'shipped']}, :order => :updated_at).paginate(:page => page, :per_page => per_page)
end

#showObject



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

def show
  @order = Order.first(:conditions => {:id => params[:id], :status => ['paid', 'shipped']})
  if not @order
    flash[:error] = t(:not_found, :scope => :order)
    return render :text => '', :status => 404
  elsif current_user.id != @order.user_id
    flash[:error] = t(:not_authorized)
    return render :text => '', :status => 401
  end
  #WTF ???
  #@order = current_user.orders
end