Where to start?

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.

On 12/13/05, Igor Z. [email protected] 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


Bill G. (aka aGorilla)

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

I second that…

Frank
----- Original Message -----
From: “Bruce B.” [email protected]
To: [email protected]
Sent: Wednesday, December 14, 2005 8:55 AM
Subject: Re: [Rails] Where to start?

Is the book still current for RoR 1.0?

On 12/13/05, Igor Z. [email protected] 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”

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.