Error messages without a model

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.

http://api.rubyonrails.com/classes/ActionController/Flash.html

-faisal

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs