Validatoin image filed


#1

hi

I have problem to check the validation of the image field
my form

<%= form_tag({:action=>‘upload’, :id => @property.id }, :multipart =>
true )%>
<%= file_field ‘image’,‘name’ %>

<%= text_area ‘image’, ‘description’, “cols” => 30,“rows” => 6
%>Description

<%= submit_tag “send” %>
<%= end_form_tag %>

image.rb
validates_presence_of :name, :description

controller
@image = Image.new(params[:image])

if !@image.valid?
error = true
end

if error
flash[:error] = “some fields are empty”
render :action =>“view”
else
bleble ble
end

tchecking the descriptoin is ok but not the name if the image because
the @image.name keep a hash ‘#’ inside and its not empty

ho to do that


#2

misiek wrote:

hi

I have problem to check the validation of the image field
my form

Please ask this on the Rails mailing list.