jeudi 18 juillet 2019

Couldn't find Order in ruby on rails

I am trying to build a page to load order id but it threw back Couldn't find Order, can you help?

routes.rb get '/orders/cancellation', to: 'orders#cancel'

<h1>Preview & Cancel your order here</h1>
<div class="block">

  <h1> Order <%= @order.name %></h1>

  <div id="multiple-file-preview">
    <ul id="sortable">
      <div class="clear-both"></div>
    </ul>
  </div>
</div>

def cancel
    paginate_versions PaperTrail::Version.where(order_id: order.id).order(created_at: :desc)
    remote_versions_pagination
  end

def order
    @order ||= Order.find_by!(shopify_id: params[:id])
  end

Aucun commentaire:

Enregistrer un commentaire