Sha256: 14d393276a2b2840d9b06bb29e1ad1f0c9bfe1b1bfabc678b52686be96fa8574

Contents?: true

Size: 635 Bytes

Versions: 6

Compression:

Stored size: 635 Bytes

Contents

require_dependency "ishapi/application_controller"

module Ishapi
  class OrdersController < ApplicationController
    before_action :check_profile, :only => [ :create ]

    def create
      authorize! :create, CoTailors::Order

      # byebug

      @order = CoTailors::Order.where( :profile_id => @current_profile.id, :submitted_at => nil ).first
      @order.submitted_at = Time.now
      flag = @order.save
      if flag
        render :json => { :status => :ok, :message => 'Successfully placed the order' }
      else
        render :json => { :status => :not_ok, :error => @order.errors.messages }
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ishapi-0.1.8.64 app/controllers/ishapi/orders_controller.rb
ishapi-0.1.8.63 app/controllers/ishapi/orders_controller.rb
ishapi-0.1.8.62 app/controllers/ishapi/orders_controller.rb
ishapi-0.1.8.61 app/controllers/ishapi/orders_controller.rb
ishapi-0.1.8.60 app/controllers/ishapi/orders_controller.rb
ishapi-0.1.8.59 app/controllers/ishapi/orders_controller.rb