Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

Capistrano deploy from local repository

Posted by Jim Morris on Fri May 26 17:08:00 -0700 2006

UPDATE 2006-12-06 I have replaced this with a full blown SCM module that works much better, see this posting

... Show more ...

Posted in Rails,Ruby  |  Tags ruby,rails,capistrano,deployment  |  no comments

Create Rails ActiveRecord Models from DDL

Posted by Jim Morris on Wed May 24 23:20:00 -0700 2006

I had a database with about 60 tables in it, most where simple lookup tables with simple has_many and belongs_to relationships, and I didn't want to manually create all the models, with the associations by hand. I googled around and came across Bill Katz's dbmodel, which takes the output of dbdesigner and creates the models with the relationships. However I already had the Databases and schema setup, and I didn't have (and couldn't find) a copy of dbdesigner to use. So I hacked Bills dbmodel to read a DDL file that was created from the command rake db:structure:dump, as I was using Postgresql this file had all the relevant relationship info in it plus a bit extra.

I added the ability to create the relationships that had non standard table names and foreign keys, and also added some validations to the created models.

... Show more ...

Posted in Rails,Ruby  |  Tags rails,ddl,activerecord  |  5 comments

An Admin page for Rails Role Based Authentication

Posted by Jim Morris on Sat May 20 13:19:00 -0700 2006

This is an example of an admin page for the Rails Recipes book Role Based Authentication, using a tree control and checkboxes for HABTM.

I used the Silverstripe tree control to render two trees, on the left a list of all Roles and what Rights they have. On the right a tree with all controllers and a checkbox for each action for each controller, under that a set of checkboxes that allow you to apply the selected rights to the selected Roles.

... Show more ...

Posted in Rails  |  Tags ruby,rails,rbac  |  10 comments