# Where to start?

**URL:** <https://www.ruby-forum.com/t/where-to-start/50166>\
**Category:** Rails\
**Created:** [December 13, 2005, 9:17pm UTC](https://www.ruby-forum.com/t/where-to-start/50166 "2005-12-13T21:17:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![igorz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f4b2a3/32.png) [@igorz](https://www.ruby-forum.com/u/igorz)\
**Post date:** [December 13, 2005, 9:17pm UTC](https://www.ruby-forum.com/t/where-to-start/50166/1 "2005-12-13T21:17:52Z")

</div>

My name is Igor.

I am, probably, a bit newer then new, even though I program for 10+  
years.  
I can program RPG(Mainframe), VB(Lotus Notes), some Delphi.  
I went through “ONLamp\_com Rolling with Ruby on Rails/cookbok” tutorial  
and I made some kind of fancy rhtmls with very basic functions.

My goal is to make a db, put on the web for the group where I belong and  
others (fly fishing).

I am currently reading “Programming Ruby” book.

One thing definetely screws up my sweet dreams: how to do validation?  
I know “if” and “else”, but  
where to put them?  
in which folder?  
how to pop up or display message?

Is the book I am reading is the proper book for me at this time?  
What would you suggest me to read?

I appriciate your help.

Happy Holidays.

---

<div class="post-metadata">

**Author:** ![igorz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f4b2a3/32.png) [@igorz](https://www.ruby-forum.com/u/igorz)\
**Post date:** [December 13, 2005, 10:04pm UTC](https://www.ruby-forum.com/t/where-to-start/50166/2 "2005-12-13T22:04:47Z")

</div>

On 12/13/05, Igor Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am currently reading “Programming Ruby” book.
> 
> One thing definetely screws up my sweet dreams: how to do validation?  
> I know “if” and “else”, but  
> where to put them?  
> in which folder?  
> how to pop up or display message?
> 
> Is the book I am reading is the proper book for me at this time?  
> What would you suggest me to read?

Agile Web D. with Rails  
[http://www.pragmaticprogrammer.com/titles/rails/index.html](http://www.pragmaticprogrammer.com/titles/rails/index.html)

> 

–  
Bill G. (aka aGorilla)

---

<div class="post-metadata">

**Author:** ![igorz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f4b2a3/32.png) [@igorz](https://www.ruby-forum.com/u/igorz)\
**Post date:** [December 14, 2005, 2:57pm UTC](https://www.ruby-forum.com/t/where-to-start/50166/3 "2005-12-14T14:57:04Z")

</div>

I’d just like to put my support behind the Agile Web Dev with Rails  
book. I started there and I think it is a superb book by a couple of  
very clear thinking and clear writing people.

bruce

---

<div class="post-metadata">

**Author:** ![igorz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f4b2a3/32.png) [@igorz](https://www.ruby-forum.com/u/igorz)\
**Post date:** [December 14, 2005, 7:01pm UTC](https://www.ruby-forum.com/t/where-to-start/50166/4 "2005-12-14T19:01:07Z")

</div>

I second that…

Frank  
----- Original Message -----  
From: “Bruce B.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Wednesday, December 14, 2005 8:55 AM  
Subject: Re: [Rails] Where to start?

---

<div class="post-metadata">

**Author:** ![igorz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f4b2a3/32.png) [@igorz](https://www.ruby-forum.com/u/igorz)\
**Post date:** [December 14, 2005, 7:16pm UTC](https://www.ruby-forum.com/t/where-to-start/50166/5 "2005-12-14T19:16:13Z")

</div>

Is the book still current for RoR 1.0?

---

<div class="post-metadata">

**Author:** ![igorz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f4b2a3/32.png) [@igorz](https://www.ruby-forum.com/u/igorz)\
**Post date:** [December 14, 2005, 7:46pm UTC](https://www.ruby-forum.com/t/where-to-start/50166/6 "2005-12-14T19:46:19Z")

</div>

On 12/13/05, Igor Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am currently reading “Programming Ruby” book.

Awesome book!

> One thing definetely screws up my sweet dreams: how to do validation?  
> I know “if” and “else”, but  
> where to put them?  
> in which folder?  
> how to pop up or display message?

Agile Web D. explains all of this. Definitely get it!

In short validation/popup goes in the model like this:

validates\_format\_of :image\_url,  
:with =\> %r{^http:.+.(gif|jpg|jpeg|png)$}i,  
:message =\> “mist be a URL for a GIF, JPG,  
JPEG, or PNG image”

---

<div class="post-metadata">

**Author:** ![igorz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f4b2a3/32.png) [@igorz](https://www.ruby-forum.com/u/igorz)\
**Post date:** [December 14, 2005, 7:51pm UTC](https://www.ruby-forum.com/t/where-to-start/50166/7 "2005-12-14T19:51:46Z")

</div>

The agile book is still good, but the newest features aren’t documented  
(RJS templates for example). But you’ll learn all but the most advanced  
things.

> One thing definetely screws up my sweet dreams: how to do validation?  
> I know “if” and “else”, but  
> where to put them?  
> in which folder?  
> how to pop up or display message?

You know how the web works?

1. you click the submit-button of your form
2. the application checks the data in the form
3. the application generates HTML and sends it to the browser
4. the browser displays the HTML

So the message should be in the result HTML. If you do a:  
ruby script/generate scaffold Post

And open models/post.rb you should see something like:

class Post \< ActiveRecord::Base  
end

A Post has a title. And every post should have a title so you must type  
in the form or get an errormessage. We need to add a validation for  
this:

class Category \< ActiveRecord::Base  
validates\_presence\_of :title  
end

This validates the presence of the title. This will be checked every  
time you save a Post.

The message should be above the form:

\<%= error\_messages\_for ‘post’ %\>

Title  
\<%= text\_field 'post', 'title' %\>

The first line displays all error messages.
