Conclusion of Chapter 6

Ok, I’m going to cheat a little bit. :)

I’m going to go to RubyForge and grab the latest version of Ackbar in CVS. The reason for this is because Assaph already has put in a fix for the DateTime issue I had in my last post. Also, he has a fix in for an error that I haven’t mentioned yet: when I would click on “edit” for an existing record on my “Listing products” page, I would get a full screen error stating, “Expecting a list of IDs!”.

Anyway, both of these errors, and the error I posted about a couple of days ago have all been fixed in CVS head, so grab it if you are following along.

Back to Chapter 6. Page 64. I add the validates_presence_of code to the Product class. Switch over to my browser and try to add a new, empty record. I get the three validation errors. Great! I enter data into the fields and click “Create” again. This time Rails adds the new record.

Page 65. I open up the Product class again to add the validates_numericality_of code for :price. I test this and do indeed get an error message when trying to save alphabetic characters in the :price field.

Page 66. I add the validate method in class Product to check for a positive number in :price. I test this and it gives me an error when I attempt to save -123 in :price.

Page 66. I add in the last two validations: uniqueness of :title and format of :image_url. I test for both and they throw errors as expected.

Were making good progress!

Page 67. I make all of the changes to list.rhtml and scaffold.css. I put some images in public images. I switch over to my browser and reload admin/list. Everything looks great.

I click on “Destroy” for one of the records, and the record is deleted. I edit the description of a record, and do a “cat products.tbl” to make sure it is reflected in the database.

By the way, here’s another reason why Ackbar/KirbyBase might be attractive to you. Since KirbyBase tables are simply text files, it’s very easy to open them up and make sure changes you make in a Rails app are properly reflected in the database.

Alright. I’m done with Chapter 6 and, besides a few minor glitches that Assaph has already fixed, Ackbar/KirbyBase passed the test.

On to Chapter 7!

About these ads

February 20, 2006. Ruby.

9 Comments

  1. Zmajrsy replied:

    http://1.xxxsexygirl69d.info x

  2. international student travel insurance replied:

    international student travel insurance

    protectiveness grosses container.distributing,recalculating

  3. casinosfreebonusesv replied:

    deposit free bonus casino
    see to signature…

  4. freeeeringtones replied:

    popular free ringtones

    http://www.thehotstop.info

    signature…

  5. european sportsbook replied:

    european sportsbook

    Brewster bluster,leadership incidence confident?

  6. weipsed replied:

    ONLINE – DRUGSTORE!
    PRICES of ALL MEDICINES!

    FIND THAT NECESSARY…
    VIAGRA, CIALIS, PHENTERMINE, SOMA… and other pills!

    Welcome please: pills-prices.blogspot.com

    NEW INFORMATION ABOUT PAYDAY LOANS!

    Welcome please: payday-d-loans.blogspot.com

    GOOD LUCK!

  7. sao cars insurance replied:

    sao cars insurance

    copyrighted invective foreign?assenter mailing

  8. vente de jeu de poker replied:

    telecharger jeu poker…

    VonAnfang le poker en ligne français poker spielen software wo kann man poker spielen video poker online gratis poker game gratis download…

  9. www casino de paris replied:

    www casino de paris…

    Officially no deposit bonus online casino deutsche casino online casino jeux de table download free ringtones wwe poker flash on line…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Trackback URI

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: