Validate_presence_of problem


#1

Hi
In my application i want to validate the fields of perticular views.
in my application:
controller name: streams_controller
model name: stream
and i want to validates a text field in the view “new.html.erb”.here
tis field take a file to be uploaded

i have a text field called :location in new.html.erb view
to validate this field i have wriiten code in model like:

class Stream < ActiveRecord::Base
validates_presence_of :location



end

i did not see any validation.
Can any one help where i am doing hte mistake.

thanks
Srikanth


#2

On Thu, Mar 5, 2009 at 6:34 AM, srikanth removed_email_address@domain.invalid wrote:

to validate this field i have wriiten code in model like:

thanks
Srikanth

Hi, please take a look at look at the following:

validates_presence_ofhttp://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M002107

Good luck,

-Conrad