hi all!
I m trying to upload image using paperclip in rails3…
In users controller of my application
(M TRYIN TO DISPLAY THE IMAGE IN THE SAME PAGE OF UPLOAD FILE(BUTTON)
PAGE
)
i ve defined 2 methods
def photo
end
def update_photo
end
- In photo.html.erb *
<%= image_tag @user.avatar.url(:medium) %>
<%= button_to “Delete”, user, :method => :delete, :confirm => ‘Are you
sure
to delete the image’ %>
<% form_for :user, @user, :url => update_photo_user_path(current_user),
:html => { :multipart => true } do |form| %>choose: <%= form.file_field :avatar %> <%= submit_tag("Uploadfile") %> WEN I RUN DIS CODE IN THE BROWSER I GET
undefined method `avatar’ for nil:NilClass ERROR