The last few days have been particularly productive with the L****** management application I have been working on. In particular, I now have full user authentication working per method in the controllers. Authentication is done via several tables mapping users (username), roles (role), and components (components), via a permissions table (user_id, role_id, component_id). I figured with would be a daunting task to represent these relationships between the tables inside the models, but this was not the case thanks to ActiveRecord’s convention over configuration.
Inside the users model, I can make represent the relationships easily like
has_many :permissions has_many :roles, :through => :permissions has_many :components, :through => :permissions
Then, I can do something like:
In the above example, the user_id column in the permissions table implicitly joins the permissions table with the user’s table.
Now for some images:
The new permissions manager now easily doles our permissions for users and components. Thanks to the ActiveRecord magic above, this form is entirely constructed with a few lines of code.
The dashboard controller attempts to pull a partial template named “dashboard” from each of the controller’s listed in the components table and display its options below. Also, each of the controller’s default actions point to this template, so everything remains DRY.
The new statistics controller will pull much information from the host, including all running processes, with a search area, and AJAX periodically updating the list of processes.
One of the easier things to happen in this project has been the inclusion of Google Charts. Its API is URL driven, but as if that was too hard, Ruby has a few projects that act as wrappers for the API. I can simply run a query, and pass the results to the wrapper, and have this pretty graph draw automatically. Nice!
A very productive week I think. Now its getting close to being something I can release.