I am working on a site and ran across a problem where clicking on my 'delete' link brings up an error page. Works fine on localhost - can't figure out why this would be different in the Heroku site.
Does anyone have any idea how this could be?
My 'Pictures' controller:
class PicturesController < ApplicationController
def index
@pictures = Picture.all
end
def new
@pictures = Picture.all
@picture = Picture.new
end
def create
@picture = Picture.new(picture_params)
if @picture.save
redirect_to new_picture_path, notice: "You just uploaded a picture!"
else
render "new"
end
end
def destroy
Picture.find(params[:id]).destroy
redirect_to new_picture_path, notice: "You just deleted a picture!"
end
...
end
My picture/new view:
<h1>Upload a new picture</h1>
<br>
<div class="well">
<%= form_for @picture, :html => {:multipart => true} do |f| %>
<%= f.file_field :attachment %>
<%= f.submit "Upload", class: "btn btn-default" %>
<% end %>
<h1>Edit existing pictures </h1>
<% @pictures.each do |picture| %>
<%= image_tag picture.attachment_url(:thumb) %>
<%= link_to "Delete", picture_path(picture), method: :delete if user_signed_in? %>
<% end %>
Here are the heroku logs from when I try to delete a picture (starting with navigating to new picture page (new and edit functions in same view):
2015-11-15T16:13:49.189857+00:00 heroku[router]: at=info method=GET path="/pictures/new" host=designstatements.herokuapp.com request_id=ccb67000-b99f-4579-a664-097247d97414 fwd="73.238.59.224" dyno=web.1 connect=1ms service=46ms status=200 bytes=9770
2015-11-15T16:13:49.396294+00:00 heroku[router]: at=info method=GET path="/pictures/animate.min.css" host=designstatements.herokuapp.com request_id=fb87e1bd-b5cc-4f9f-9934-6c4076beff41 fwd="73.238.59.224" dyno=web.1 connect=1ms service=6ms status=404 bytes=1829
2015-11-15T16:13:49.478789+00:00 heroku[router]: at=info method=GET path="/pictures/js/bootstrap.min.js" host=designstatements.herokuapp.com request_id=2b36f60f-0e9a-498f-b210-74350c910540 fwd="73.238.59.224" dyno=web.1 connect=1ms service=8ms status=404 bytes=1829
2015-11-15T16:13:53.652050+00:00 heroku[router]: at=info method=GET path="/pictures/40" host=designstatements.herokuapp.com request_id=5dbb3c14-fab5-4525-a682-2d037b78dd4a fwd="73.238.59.224" dyno=web.1 connect=1ms service=10ms status=500 bytes=1754