[Catalyst] Scaffolding: Catalyst v. Rails
Joshua Keroes
jkeroes at eli.net
Wed Nov 16 02:45:43 CET 2005
I'm comparing scaffolding between Rails and Catalyst. My goal is to
have a simple CRUD interface to a database of network devices. Bonus
points if it looks slick (like Maypole's default view).
Rails setup was easy:
rails devices
ruby script/generate scaffold Device
vi config/database.yml
ruby script/server
http://localhost:3000/device/list
And it looks boring but effective. It would be better if they
supported mysql's enum().
Catalyst setup:
catalyst.pl Devices
cd Devices
script/devices_create.pl model Devices CDBI dbi:mysql:dbname=devdev
devdev devdev
script/devices_create.pl view TT TT
script/devices_create.pl controller Devices Scaffold CDBI::Devices
vi lib/Devices/Model/Devices.pm
# add to config():
additional_base_classes => [qw/Class::DBI::AsForm
Class::DBI::FromForm/],
vi lib/Devices.pm
# change 'use Catalyst qw/-Debug Simple::Static/;'
use Catalyst qw/-Debug Simple::Static FormValidator/;
http://localhost:3000/devices/list
http://localhost:3000/devices/
...and a blank page. No warnings, no complaints, but no HTML either.
Questions:
1. Did I get the lib/Devices.pm base classes correct w.r.t. order?
2. How is capitalization w.r.t. devices_create.pl's arguments?
3. Is the model name supposed to be the same as the database table?
(i.e. devices_create.pl model TableName ...) I've looked through much
of the documentation but don't see where the table name is defined.
I'd argue that this needs to be clearly documented in several places.
grepping through the docs, this is glossed over when mentioned at
all. Looks like undocumented magic to me.
4. What are the database conventions? (e.g. required columns,
recommended columns, capitalization, type, and pluralization)
Thanks,
Joshua
PS Need more info?
More information about the Catalyst
mailing list