# Not getting validation error message

**URL:** <https://www.ruby-forum.com/t/not-getting-validation-error-message/186679>\
**Category:** Rails\
**Created:** [April 11, 2010, 9:25am UTC](https://www.ruby-forum.com/t/not-getting-validation-error-message/186679 "2010-04-11T09:25:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahul\_m](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/43a26b/32.png) [@rahul\_m](https://www.ruby-forum.com/u/rahul_m)\
**Post date:** [April 11, 2010, 9:25am UTC](https://www.ruby-forum.com/t/not-getting-validation-error-message/186679/1 "2010-04-11T09:25:26Z")

</div>

i have one comment controller to put comment on article  
i have used this form add in my website part or some other  
controller  
put two validation  
validates\_presence\_of(:name,:comment)

code of other controller

@comment = Comment.new  
@commentgiven=Comment.find(:all,:conditions =\>  
“content\_master\_id=#{@content.id}”)

```
           respond_to do |format|
            format.html { render :file => "#{Rails.root}/app/

```

views/public/article.html.erb"}  
format.xml { render :xml =\> @comment }  
end

```
    the validation error message is not showing in other

```

controller  
any body can help me on this …

thanks

rahul

---

<div class="post-metadata">

**Author:** ![rahul\_m](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/43a26b/32.png) [@rahul\_m](https://www.ruby-forum.com/u/rahul_m)\
**Post date:** [April 11, 2010, 2:40pm UTC](https://www.ruby-forum.com/t/not-getting-validation-error-message/186679/2 "2010-04-11T14:40:33Z")

</div>

Rahul M. wrote:

> i have one comment controller to put comment on article  
> i have used this form add in my website part or some other  
> controller  
> put two validation  
> validates\_presence\_of(:name,:comment)
> 
> code of other controller
> 
> @comment = Comment.new  
> @commentgiven=Comment.find(:all,:conditions =\>  
> “content\_master\_id=#{@content.id}”)
> 
> ```
> respond_to do |format|
> format.html { render :file => "#{Rails.root}/app/
> 
> ```
> 
> views/public/article.html.erb"}  
> format.xml { render :xml =\> @comment }  
> end
> 
> ```
> the validation error message is not showing in other
> 
> ```
> 
> controller  
> any body can help me on this …
> 
> thanks

You are only doing new and find. Typically validations  
are run with save or update.

Plus retrieving errors happens in erb so post that  
if needed.

> rahul
