Monday, January 21, 2008

Agile Web Development with Rails

I got the book Agile Web Development with Rails today. I've read to page 71 + the Ruby language appendix. I've learned a couple of things that I didn't understand yet. For example, I learned that the scoffolding that I was so proud of for getting the application up and running, isn't meant to ship with the final product. It doesn't look pretty, but it can help you with building the application until you get the real finishing touches into the application. It really is just scaffolding.

This sentiment was confirmed on my ride home today with a fellow named David. He has been using Ruby on Rails for the last two years and he says he never uses the scaffolding. At first I was taken a back a little bit, but I can see that he is right.

A scaffolding view and controller is just a page that will put functionality in dynamically, but it doesn't care how it looks, just that you can operate the application until you get your real stuff in there.

Data Model: Customer and Customer Payment

It seems that customer payment should have a foreign key to customer as well. Shall we add that in?

Sunday, January 20, 2008

The ID field, and its relationship to show/edit from lists

I had to make sure that tables had an ID for them to automatically conform to the ROR convention. One thing that I didn't realize until now is that ID must be all in lowercase in the database for it to work. Once it is all in lower case, the show and edit links work perfectly.

I practiced with the companies table first, when I would try it out before making the ID and id, the show and edit links from the companies table always failed to work. After changing them, the show and edit work fine now.

Saturday, January 19, 2008

Should the company number be a foreign key?

I see the CO_NUMBER:INT(7) in quite a few tables:
  • companies
  • co_billings
  • company_fees
  • company_gen_fees
  • customers
  • customer_payments (ap_co_number)
  • notepads

It seems like this should be a foreign key, pointing to a primary key in the companies table.

Does this seem right?

Database Changes

In working to convert the apgschema to the Ruby on Rails convention, I had to give every table an ID in order for the links from the automatically created table to work.

In doing this, mostly I added a new ID field, but for some of them, I changed the existing primary key.

I had to execute:
SQL:
SET @maxId= 0;
UPDATE mytable SET id = ( SELECT @maxId := @maxId+1 ) WHERE 1 ;
to put the ID

I found at:
http://www.rafaeldohms.com.br/2006/09/28/creating-a-primary-key-in-a-populated-table/en/

It also creates UI for the whole database, the result of this is that we get UI with fields like CO RESERVE AMT. I could either change the database, or go into each of the UI files and alter it there. It seems to make more sense to change the database, but I'm gonna hold off for now.