# Form validation on non-CRUD activities

**URL:** <https://www.ruby-forum.com/t/form-validation-on-non-crud-activities/169245>\
**Category:** Rails\
**Created:** [June 1, 2009, 11:21am UTC](https://www.ruby-forum.com/t/form-validation-on-non-crud-activities/169245 "2009-06-01T11:21:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/13edae/32.png) [@Tom\_R](https://www.ruby-forum.com/u/Tom_R)\
**Post date:** [June 1, 2009, 11:21am UTC](https://www.ruby-forum.com/t/form-validation-on-non-crud-activities/169245/1 "2009-06-01T11:21:27Z")

</div>

Hi there,

I’m relativity new to Rails (I’ve been eying it for some time,  
though). I’m reasonably familiar with Ruby’s syntax.

When I pick up a new language, I like to make a simple blog. I’m  
focusing on the authentication at the moment. I am well aware of the  
existing plugins out there, but since this application will never see  
the light of day and I learning by rolling my own.

Now, let’s say I have a login form, how do I validate that? I’m not  
saving into a model, or anything like that. At this stage, I’m just  
using a form\_tag, and doing simple if params[:username] == ‘’ in the  
controller. Very ugly indeed.

What is the best way to validate a form (and get the nice error  
messages, like when you are scaffolding) when you are not necessarily  
saving data?

Cheers.  
Tom.

---

<div class="post-metadata">

**Author:** ![Tom\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/13edae/32.png) [@Tom\_R](https://www.ruby-forum.com/u/Tom_R)\
**Post date:** [June 1, 2009, 1:08pm UTC](https://www.ruby-forum.com/t/form-validation-on-non-crud-activities/169245/2 "2009-06-01T13:08:35Z")

</div>

Here’s what i use -  
[http://github.com/staugaard/active\_record\_base\_without\_table/tree/master](http://github.com/staugaard/active_record_base_without_table/tree/master)

- 

Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)
