Burn My Time

~Josh Houghtelin

Rails finaly dawned on me.

Josh Houghtelin Ruby

I read it. I retained it. I knew it. But didn’t realize it until now. Love those classic paradigm shifts. Anyway…

How the database is setup is important. The naming structure wether the name is single or plural is important. everything needs an ‘id’ . and everything you want to tie together needs ’singular_id’ within the table. Where singular is the singular form of the table your tying things to. This, to me, seems to be understated in the tutorials. (atleast the ones I’ve read) If you want to put together a phonebook with different catagories of people like business, personal, etc. you’d have two tables. (table names seem to enjoy being plural) so your contact table would be named “Contacts” and “Catagories” for your catagory table. Both of which would have an auto_increment ‘id’. The table Contacts would have a field named “catagory_id”… singular_id. and so on. Which brings me around to where I wanted to be.

Models. After starting to figure out how the database crap worked, the model started to make sense. “script/generate model mything” the model script is run for all the tables and figures out what is going on w/the tables & builds the associations from one table to another based off the names, id’s, etc.

Controllers, “script/generate controller mything”, do everything. This is where all the information is processed. Controllers are where you hide all the ruby that decides what’s going on and how what’s going on is going to be delt with.

Views , “app/views/*”, are files you edit to change the way things look. A little ruby. html to lay things out. done.

If you just know how the scripts work & how to setup the databases you can use the scripts to put together just about any simple database application in just a few seconds. It seriously takes all the tedious annoying typing out of framework setup. Combine that w/the high volume of kickass, swiftness, n’ simplicity that plain old ruby scripting brings to the table n’ ya got yourself a rockin utility. The more I learn, the more I like it.

Leave a comment!



Message



Burn My Time © 2007.

Simple Grey theme developed by Rodrigo P. Ghedin.
Brought by Wordpress Themes

WordPressFAMFAMFAM