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| %>
<table>
<tr>
<td>choose:
<%= form.file_field :avatar %>
</td>
</tr>
<tr>
<td>
<%= submit_tag("Uploadfile") %>
</td>
WEN I RUN DIS CODE IN THE BROWSER I GET
undefined method `avatar' for nil:NilClass ERROR
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.