# Error messages without a model

**URL:** <https://www.ruby-forum.com/t/error-messages-without-a-model/92972>\
**Category:** Rails\
**Created:** [April 26, 2007, 5:37am UTC](https://www.ruby-forum.com/t/error-messages-without-a-model/92972 "2007-04-26T05:37:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nielsene](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nielsene](https://www.ruby-forum.com/u/nielsene)\
**Post date:** [April 26, 2007, 5:37am UTC](https://www.ruby-forum.com/t/error-messages-without-a-model/92972/1 "2007-04-26T05:37:55Z")

</div>

Is there an easy way to create error messages and display them in the  
view without using a model from ActiveRecord. I just quickly added a  
temporary new field to a form that I have no desire to store in the db  
and will probably remove it shortly. I used text\_field\_tag on the view  
which doesn’t require a model but if it’s not provided by the user I  
still want to return the error message to the view. I was just hoping  
for a simple way to return error messages to the view without having  
to add them to a model.

---

<div class="post-metadata">

**Author:** ![nielsene](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nielsene](https://www.ruby-forum.com/u/nielsene)\
**Post date:** [April 26, 2007, 6:00am UTC](https://www.ruby-forum.com/t/error-messages-without-a-model/92972/2 "2007-04-26T06:00:56Z")

</div>

[http://api.rubyonrails.com/classes/ActionController/Flash.html](http://api.rubyonrails.com/classes/ActionController/Flash.html)

-faisal

---

<div class="post-metadata">

**Author:** ![nielsene](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nielsene](https://www.ruby-forum.com/u/nielsene)\
**Post date:** [April 26, 2007, 2:04pm UTC](https://www.ruby-forum.com/t/error-messages-without-a-model/92972/3 "2007-04-26T14:04:23Z")

</div>

Hi Eric,

Eric N. wrote:

> Is there an easy way to create error messages and display them in the  
> view without using a model from ActiveRecord. I just quickly added a  
> temporary new field to a form that I have no desire to store in the db  
> and will probably remove it shortly. I used text\_field\_tag on the view  
> which doesn’t require a model but if it’s not provided by the user I  
> still want to return the error message to the view. I was just hoping  
> for a simple way to return error messages to the view without having  
> to add them to a model.

It sounds like the flash method, probably along with some logic to  
redirect\_to :back in the case of an error, should give you what you’re  
looking for.

hth,  
Bill
