misiek
3/8/2006 7:21:00 PM
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' %><br>
<%= text_area 'image', 'description', "cols" => 30,"rows" => 6
%>Description<br>
<%= 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