# Attachment\_fu validations

**URL:** <https://www.ruby-forum.com/t/attachment-fu-validations/110011>\
**Category:** Rails\
**Created:** [July 21, 2007, 4:17am UTC](https://www.ruby-forum.com/t/attachment-fu-validations/110011 "2007-07-21T04:17:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcgrigsby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5e925/32.png) [@dcgrigsby](https://www.ruby-forum.com/u/dcgrigsby)\
**Post date:** [July 21, 2007, 4:17am UTC](https://www.ruby-forum.com/t/attachment-fu-validations/110011/1 "2007-07-21T04:17:14Z")

</div>

I tried following an attachment\_fu ajax tutorial online but am having  
trouble displaying the validations. Here is the tutorial:  
[http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment\_fu-and-responds\_to\_parent](http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent)

The validations work but are not displayed…  
Here’s my index.rhtml page:

# Photo Gallery

Photos

\<% @photos.each do |photo| %\> \<%= render(:partial =\> '/photos/list\_item', :object =\> photo)%\> \<% end %\>

Upload
\<%= error\_messages\_for :photo %\>

\<% form\_for(:photo, :url =\> formatted\_photos\_path(:format =\> ‘js’),  
:html =\> { :multipart =\> true, :target =\> ‘upload\_frame’}) do |form| %\>  
\<%= render(:partial =\> ‘/photos/form’, :object =\> form) %\>  
\<% end %\>

and the create action in my controller:

def create  
@photo = Photo.new(params[:photo])  
@user = User.find(session[:user\_id])

```
respond_to do |format|

```

if @user.photos \<\< @photo

```
  flash[:notice] = 'Photo was successfully created.'
  format.html { redirect_to photo_url(@photo) }
  format.xml { head :created, :location => photo_url(@photo) }
  format.js do
    responds_to_parent do
      render :update do |page|
        page.insert_html :bottom, "photos", :partial =>

```

‘photos/list\_item’, :object =\> @photo  
page.visual\_effect :highlight, “photo\_#{@photo.id}”  
end  
end  
end  
else  
format.html { render :action =\> “new” }  
format.xml { render :xml =\> @photo.errors.to\_xml }  
format.js do  
responds\_to\_parent do  
render :update do |page|  
end  
end  
end  
end  
end  
end
