Recently I installed Paperclip gem and I am struggling to make the default image work on my system, I put the image file inside assets/images/pic.png
.
This is code in my model User
:
has_attached_file :pic,
:styles => { :medium => "300x300>", :thumb => "100x100>" },
:default_url => 'missing_:avatar.png'
#:default_url => 'assets/images/avatar.png'
has_attached_file :attach
This is code inside my AddPicPaperClip
migration:
def self.up
add_column :users, :pic_file_name, :string
add_column :users, :pic_content_type, :string
add_column :users, :pic_file_size, :integer
add_column :users, :pic_updated_at, :datetime
add_attachment :users, :pic
end
def self.down
remove_column :users, :pic_file_name
remove_column :users, :pic_content_type
remove_column :users, :pic_file_size
remove_column :users, :pic_updated_at
remove_attachment :users, :pic
end
In order to display the image in my show I have this code:
<%= image_tag @user.pic.url(:medium) %>
Could you help me find a solution, in order to show a default picture before a user inputs his own profile picture?