0
votes

new to rails (and programming) here. I am having an error in my app when uploading a photo, in which the broken photo icon appears and the image is set to "/images/medium/missing.png"

I have ImageMagick and Paperclip set up, migrations done, everything seems to be in order, no errors except for this. And it does not actually give an error, the upload seems to go through but it just shows the broken photo icon.

Here is my routes.rb:

  MyApp::Application.routes.draw do
  resources :pins

  devise_for :users
  root "pages#home"

  get "about" => "pages#about"
  get "team" => "pages#team"

not sure what else might help to provide just let me know.

User Model :

class User < ActiveRecord::Base

devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable

has_many :pins

end

1
Which version of rails are you using? What is the URL you are trying to access? What are you doing in the view to display the image?Kumar Akarsh
What is in your log/development.log file?Aluxzi
do you have the folder medium containing missing.png in any of your assets/images folder???bjhaid
@akarsh using rails 4.0.2...I am not sure what the URL should be, I just want the image to be at the URL. here is my views/pins/show.html.erb <%= image_tag pin.image.url(:medium) %> <p> <strong>Description:</strong> <%= pin.description %> </p> <% if pin.user == current_user%> <%= link_to 'Edit', edit_pin_path(pin) %> | <% end %> <%= link_to 'Back', pins_path %>Brunnals
@aluxzi what exactly am I looking for in there?Brunnals

1 Answers

2
votes

GOT IT!!!! In app / views / pins / _form.html.erb update f.file_field to:

 <%= f.file_field :image, class: "form-control" %>