In the past month we took some first steps to inviting women into the SF Ruby community:

  1. First Workshop was well attended with tremendous community support
  2. Hack session (sponsored by Orange and Sustainable Websites) where many of the workshop attendees continued their learning; and women and men from the community brought their own projects to work on.

Now we need to keep up the momentum and generate a few more peers for the women who are continuing to develop in Ruby. To that end, we have scheduled another workshop, July 31-August 1 with the generous support of Pivotal Labs and EngineYard.  In order to make this workshop as successful as the last one, we need your help:

  • Please sign up to volunteer on Friday and/or Saturday:
    • if you are a developer who has experience with Ruby on Rails and are willing to answer questions and offer debugging assistance during the workshop
    • if you attended the last workshop, you will learn a lot from being a TA!
    • if you just want to help, we need folks for registration and other logistics
  • Sponsors
    • we haven’t yet planned an “after party” but it would be great to do that again
    • do you have some cool stuff you want to bestow upon our attendees, good books? special deals? let’s make these new folks feel welcome
  • Locations for follow-up events: do you have space you would be willing to share on a weekend or evening?
    • post-workshop hack session: informal workspace or conference room
    • advanced workshop: two conference rooms would be ideal
    • September workshop: large meeting room with a number of smaller conference rooms

If you want to get involved, please join the google group.
Sponsors please email rubyworkshop _at_ gmail (dot) com.

After my recent ActiveScaffold post, I heard about several newer alternatives from Jaime Flournoy, Mike Gunderloy, and some more web surfing. I evaluated four plugins for admin UI, using the following methodology:


rails xxx_simple
cd xxx_simple/
./script/generate scaffold Task title:string notes:text complete:boolean
rake db:migrate

plus whatever annotations to the code the plugin needed. Then I ran a little script to generate 500 records:

500.times do |counter|
  `curl -X POST -d "Another thing #{counter}More text with #{counter} thing" -H "Content-Type: application/xml" http://localhost:3000/tasks.xml`
end

They all support related models, but I only have screen shots from my simple test. I’ve listed them below with the ones I liked best at the top.

typus

Typus is the one I’m moving forward with. It has a clean interface and has nice configuration options. You can configure which columns are displayed and which are searched (with a nice UI touch of displaying the search criteria under the search box). It is actively maintained with quite a few contributors and a responsive google group. I really like how relationships are displayed (for which I don’t have a picture, sorry). The only drawback (for me) is that it has its own auth and I don’t really want to introduce a separate set of admin users for the project I am working on, and I’ll be looking into making a change to support my own auth.  By default, it adds it’s own typus_users table, but this could be a plus for some.


script/plugin install git://github.com/fesplugas/typus.git
script/generate typus
rake db:migrate
./script/server

Now visit http://localhost:3000/admin and you will be prompted for your email address, from which it will automatically create the first admin user (pretty slick). The default UI looks like this:


I ran into just one glitch where Rails reported "A copy of ApplicationController has been removed from the module tree but is still active!" but it was easily fixed. The error didn't happen in my simple project, but did in my real app. Francesc Esplugas has looked into it and so far can't reproduce it.

admin_data

I really liked admin_data. The simplicity of the install was breath-taking:

ruby script/plugin install git://github.com/neerajdotname/admin_data.git
sudo gem install will_paginate
./script/server

that's it. Now visit http://localhost:3000/admin_data and you'll see the following interface:


I didn't try it, but I really like the admin_data approach to integrating with the application's authentication: Add the following lines of code in an initializer at ~/config/initializers/admin_data.rb


# authorization check to see if the data should be shown to the user
ADMIN_DATA_VIEW_AUTHORIZATION = Proc.new { |controller|
   controller.send("admin_logged_in?") }
# authorization check to see if the user should be allowed to update the data
ADMIN_DATA_UPDATE_AUTHORIZATION = Proc.new { |controller| return false }

streamlined

Streamlined is nice, but not as pretty as ActiveScaffold. Not compatible with Rails 2.3. This and active_scaffold seem to be a little older than typus and admin_data and require you to modify your code similarly. I thought it nice that it provided its own admin layout. In my simple test I applied the series of steps and nested route as with active_scaffold.

class MyNiftyController < ApplicationController
  layout 'streamlined'
  acts_as_streamlined

...[anything else you want to do]
end


active_scaffold

See my previous post for details. This seems to be the grand-daddy of this genre of plugins and has a very active google group. I liked this plugin when I first tried it, but it hung when I applied it to my real app. Also, @jamieflournoy notes that he didn't like the UI for editing related models as much as he did Streamlined.

The ActiveScafold plugin for Rails promises to be a huge time saver.  In just a few easy steps, you can create a full web interface for your database, complete with inline editing and fold out panels.  Of course, it helps to have some grasp about what it is doing or you can get stuck like I did this morning.  I’m no expert (yet), but since it is so very cool, I wanted to share what I’ve learned (with the help of Sean Dick and Ivan Storck at tonight’s SFRuby Hack session).

After installing the plugin, there are just 3 lines of code that magically generate the HTML pages, but the trick is knowing where to put them. There’s a nice intro on the github wiki that outlines common use cases:

  • Prototyping
  • Admin Interfaces
  • Embedded, Widget-Style
  • Data-Heavy Applications

The use case that led me to ActiveScaffold today was the creation of an admin interface.  I’m working on a website and the end user stuff is pretty nice, but there are a bunch of tables where the data needs a little love… no one wants to launch the site without at least a few corrections in the data and it is crazy to either delay the launch while we build an admin interface or have an engineer make corrections with sql updates.  Enter ActiveScaffold: a way to allow admins to make the changes they need with very little software development.  (Later I expect we’ll need to add some fancy bits to the admin interface, but ActiveScaffold promises to be configurable and extensible enough when the time comes and the key point is that I don’t expect to need those features this week.)

ActiveScaffold for Admin

Make a little app for this experiment:

rails active_scaffold
cd active_scaffold
./script/generate scaffold Task title:string notes:text  complete:boolean
rake db:migrate

Install the plugin, which is compatible with Rails 2.3.2 (yay!) and previous versions of rails (if you install  a specific revision)

./script/plugin install git://github.com/activescaffold/active_scaffold.git

Now we have an app that lets you create, view, edit and delete tasks. This is the end-user app, you could edit the views and remove controller actions to prevent editing, deleting and/or creation. We want to leave this interface as is, but create a separate set of pages to allow an administrator to view, create, modify and delete tasks.

Sean came up with the idea of using routes with a namespace to facilitate this. Here’s what we came up with:

In config/routes.rb add the following code:

map.namespace :admin do |admin|
   admin.resources :tasks
end

Create a copy of /app/views/layouts/tasks.html.erb and call it admin.html.erb (in same folder), then add the following lines inside the <head> tag:

Create app/controllers/task_controller.rb:

class Admin::TasksController < TasksController
   layout "admin"
   active_scaffold :task
end

Check it out:

http://localhost:3000/admin/tasks


and when you click edit: