Newbie Ruby on Rails with Locomotive, Part 2

5 October 2007 - Permanent link - Categories: implementation

Thanks to http://safari.oreilly.com and the O'Reilly Rails Cookbook, I have learned the answer to my burning question:

Yes, I *do* need to create join tables in my database migration definition files.
It wasn't clear to me at first, but now what I'm realizing -- and hopefully this is correct -- is that the rails migration schema file is really just an abstracted way of writing a database setup script. Rails can translate its file into the setup script for whatever database you're using, but you still have to specify all the joins, defaults, etc. just as you would if you were setting up the database in its native language. Check and check.

I do use the scaffolding command to create multiple model-controller relationships. (See O'Reilly OnLamp: Rolling with Ruby on Rails Revisited.)

"test" is a reserved word.
This is apparently a problem. I'm building a DB to track usability tests, and I named one of my tables "test". I'm trying to migrate to "usabilitytests" but i'm running into problems. Solved by deleting the entire app and recreating. Obviously not something that one would always want to do, but I don't know how to un-create models and controllers and whatnot that have already been set.

functions in the controller are lowercase with underscores.
I'm not entirely sure of this, but I downloaded a sample application and checked out that code.

TOTALLY STUMPED: Radio buttons in RoR?
Okay, I found the documentation for how to render a checkbox. Am I smoking crack? Did the entire RoR project forget about the existence of radio buttons? From an interaction perspective, radio buttons are the exact same as SELECT boxes: They afford one-from-many selection. They're just rendered in an easier-to-read and easier-to-operate widget. (Select boxes are hard for people to use, and even if you know what you're doing, they're way more of a pain particularly for administrative-type applications when you interact with the box a billion times a day.) I expect there to be a function like collection_radio that operates almost exactly the same as collection_select -- but as far as I can tell, no such thing exists.