[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Beginning Ruby

Gavin Kistner

10/26/2006 8:45:00 PM

From: phalcos [mailto:phalcos@gmail.com]
> Im quite new to Ruby (unexpected heh?) but is currently planning on
> building a website community with it just in order to see how powerful
> it accually can be.

Welcome!
Are you planning on using any existing Ruby web framework (Rails, IOWA,
RubyWeb, to name just a few) to build your website, or creating your own
from scratch?


> 1. How can I make sure the userinput only contains certain characters?
> Like if I only want my users to be able to give me [A-Za-z0-9], is
> regex the only alternative?

Regex is not your only alternative, but certainly one of the more
flexible/powerful. input.gsub!( /\W/, '' ) # so easy! :)
A lot of the frameworks have their own ways to describe and
auto-validate input for you.

> 2. Is there any builtin method for converting html-characters
> into safe input, like what htmlspecialchars in PHP does?

See http://phrogz.net/ProgrammingRuby/lib_network.html#CGI....
And again, Rails and others have their own helpers on this front.

> 3. Methods for SQL database storage?

Again, more helpers for the frameworks, like ActiveRecord for Rails.
If you're rolling your own, it depends on the database.
Ruby's DBI is a RDBMS-independent wrapper:
http://ruby-dbi.ruby...


> 3. Anything else I should think about?

Think about learning one of the popular frameworks. It may be a
significant change from being used to handle every aspect of the
development yourself, but you may find that you like the power and
development speed that they give you.