23 lines
482 B
Ruby
Executable File
23 lines
482 B
Ruby
Executable File
class Api::CustomersController < ActionController::API
|
|
|
|
#List all active customers by name
|
|
def index
|
|
@customers = Customer.order("name asc")
|
|
end
|
|
|
|
#Show customer by ID
|
|
def show
|
|
@customer = Customer.find_by(params[:id])
|
|
end
|
|
|
|
#Show customer detail by Order item
|
|
def get_customer_order
|
|
@customer = Customer.find(params[:id])
|
|
end
|
|
|
|
#Show customer last five order
|
|
def get_customer_last_orders
|
|
@customer = Customer.find(params[:customer_id])
|
|
end
|
|
end
|