Skip to content

Instantly share code, notes, and snippets.

@mfifth
Last active March 30, 2017 00:31
Show Gist options
  • Select an option

  • Save mfifth/1fa38196fc5d89955c99134d0dcf11b2 to your computer and use it in GitHub Desktop.

Select an option

Save mfifth/1fa38196fc5d89955c99134d0dcf11b2 to your computer and use it in GitHub Desktop.
<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>
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