Last active
March 30, 2017 00:31
-
-
Save mfifth/1fa38196fc5d89955c99134d0dcf11b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div> | |
| <% if flash[:notice].present? %> | |
| <script> | |
| $(document).on("turbolinks:load", function() { | |
| $(".page-heading").after("<div class='flash flash-notice'><%= flash[:notice] %></div>"); | |
| }); | |
| </script> | |
| <% flash.clear %> | |
| <% end %> | |
| <%= yield %> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class OrderProductsController < ApplicationController | |
| def update | |
| @order_product = OrderProduct.find(params[:order_product][:product_id]) | |
| @order_product.dropbox_link = params[:order_product][:dropbox_link] | |
| @order_product.save | |
| respond_to do |format| | |
| if @order_product.save | |
| format.js | |
| else | |
| format.html do | |
| flash[:notice] = "Please include https:// to the beginning of your dropbox link." | |
| redirect_to "/dashboard" | |
| end | |
| end | |
| end | |
| end | |
| def edit | |
| @product = OrderProduct.find(params[:id]) | |
| @designers = Designer.all | |
| @printers = Printer.all | |
| end | |
| private | |
| def products_params | |
| params.require(:order_product).permit(:product_id, :dropbox_link) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment