Hi,
In user model, do u have any field named avatar? and also y ur passing
user as symbol and instance variable in form_for tag? remove the symbol.
Thanks,
Manivannan.s
On Fri, Aug 12, 2011 at 2:45 PM, Annapoorna R
<prapoorna.r-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
--
Regards,
Manivannan.S
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.