# Validate\_presence\_of problem

**URL:** <https://www.ruby-forum.com/t/validate-presence-of-problem/162081>\
**Category:** Rails\
**Created:** [March 5, 2009, 3:38pm UTC](https://www.ruby-forum.com/t/validate-presence-of-problem/162081 "2009-03-05T15:38:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![srikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@srikanth](https://www.ruby-forum.com/u/srikanth)\
**Post date:** [March 5, 2009, 3:38pm UTC](https://www.ruby-forum.com/t/validate-presence-of-problem/162081/1 "2009-03-05T15:38:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![srikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@srikanth](https://www.ruby-forum.com/u/srikanth)\
**Post date:** [March 5, 2009, 4:07pm UTC](https://www.ruby-forum.com/t/validate-presence-of-problem/162081/2 "2009-03-05T16:07:17Z")

</div>

On Thu, Mar 5, 2009 at 6:34 AM, srikanth [removed\_email\_address@domain.invalid](mailto: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\_of[http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M002107](http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M002107)

Good luck,

-Conrad
