Forum: Ruby validatoin image filed

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
misiek (Guest)
on 2006-03-08 20:26
(Received via mailing list)
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
40d29f4725ff04ff0d69ccea0bcbdc11?d=identicon&s=25 Andreas S. (andreas)
on 2006-03-08 20:27
misiek wrote:
> hi
>
> I have problem to check the validation of the image field
> my form

Please ask this on the Rails mailing list.
This topic is locked and can not be replied to.