Sounds like something you can do with ActiveRecord validations:

http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html

for example:

validates_numericality_of :some_numer
validates_length_of :something_else, :in => 3..12

You can use validate_format_of :a_date (and specify a regex), or there's a
plugin that helps for this (i haven't tried it:
http://railslodge.com/plugins/111-validates-date-time)

etc...

is that what you're looking for?

On Mon, Feb 2, 2009 at 12:10 PM, Daniel López <
rails-mailing-l...@andreas-s.net> wrote:

>
> Harold wrote:
> > Can you give an example of what you mean by "validate the data before
> > passing it over to SQL"?
> >
> > If it's SQL injection you're worried about, rails can help clean up
> > user input, but I'm not sure that's where your heading with this...
> >
> >
> >
> > On Feb 2, 11:18�am, Daniel L�pez <rails-mailing-l...@andreas-s.net>
>
> SQL Injection, mmm... yes, maybe, but I refer particularly to check if a
> string is numeric, date type or too short for the database values (for
> example).
>
> Only if these requirements are OK, the select query is executed.
> Otherwise, the application should return false or something.
>
> Thanks in advance, Harold. ;)
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to