Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.
Ruby Inside - A Ruby Blog

AutoAdmin: Auto-generated admin interface in a Rails plugin

By Peter Cooper / August 17, 2006

[画像:Autoadmin]

AutoAdmin is a new plugin for Rails that automatically generates an administration interface for your models. It's heavily inspired by Django, where meta-data relating to the administration interface is placed directly into the models. This goes directly against David Heinemeier Hansson's preferences, but might be perfect for your own systems.

Example model code:

class Customer < ActiveRecord::Base
 belongs_to :store
 has_many :payments, :order => 'payment_date DESC'
 def name; first_name + '' + last_name; end
 sort_by :last_name
 search_by :first_name, :last_name
 filter_by :active, :store
 default_filter :active => true
 list_columns :store, :first_name, :last_name
 admin_fieldset do |b|
 b.text_field :first_name
 b.text_field :last_name
 b.select :store
 end
 admin_child_table 'Payments', :payments do |b|
 b.static_text :payment_date
 b.static_text :amount
 end
end

Comments

  1. Mike Blair says:
    August 17, 2006 at 10:29 pm

    Cool, the admin interface was by far the best part of Django.

  2. Jeff says:
    August 18, 2006 at 12:04 am

    Thanks, I was looking for a write up of this earlier today, but couldn't find one. Finding this in my feed agg hit the spot.

  3. Christoffer Sawicki says:
    August 18, 2006 at 8:42 pm

    Another project with similar scope: http://streamlined.relevancellc.com/

Other Posts to Enjoy

Twitter Mentions

AltStyle によって変換されたページ (->オリジナル) /