My favorites | Sign in
Project Logo
                
Feeds:
People details
Project owners:
  shantibraford

RailsMyAdmin

RailsMyAdmin is a backend database management addon for your Rails applications.

It's available in the form of a Rails plugin, with an accompanying generator which copies the various RailsMyAdmin files necessary into subfolders in your application.

It's inspired by the simplicity and usefulness of phpMyAdmin, but leverages Rails functionality to achieve similar results (and more!).

Installation

Install the plugin with:

ruby script/plugin install http://railsmyadmin.googlecode.com/svn/trunk/my_admin/

Once the plugin is installed, generate the RailsMyAdmin files with:

ruby script/generate my_admin

Note: this will copy files from the plugin folders into your application folders.

Next, copy the following code snippet into the bottom of your environment.rb file:

## MY ADMIN CONFIG
require 'my_admin/my_admin_tool'

# If you only want certain models to be available to RailsMyAdmin,
# set :all_models to false and specify the desired models in MY_ADMIN_MODELS
MY_ADMIN_GLOBALS  = {:all_models => true, :confirm_destroy => false}

# Uncomment the following line if you set :all_models to false above.
#MY_ADMIN_MODELS = [User, Content]
# Replace [User, Content] with your desired array of model classes that
# RailsMyAdmin should be restricted to.

# MY_ADMIN_AUTH must define a Proc object that takes as a paramater
#   an ApplicationController instance variable (c - in the example below).
# If you have a method defined in your ApplicationController,
#   'admin_logged_in?' for example, the following sample code will
#    authenticate against that method and only allow visitors to
#    view RailsMyAdmin if the 'admin_logged_in?' method returns true.

MY_ADMIN_AUTH     = Proc.new { |c| c.send('admin_logged_in?') }

Note: authentication is disabled by default for the Development environment.

Usage

If you are developing your application locally (port 3000), you can test drive railsMyAdmin once the above steps have been completed by visiting:

http://localhost:3000/my_admin/main

Command List

To obtain a list of other RailsMyAdmin rake tasks:

rake -T my_admin

Other Features

RailsMyAdmin features an AJAX-driven DiggSpy-like functionality for watching new rows getting added to tables.

This could come in handy, for say, watching an 'events' table on a very busy site, where new rows are getting added every few seconds or minutes.

Works at the Rails Level

RailsMyAdmin uses ActiveRecord object's methods to edit, update, save and destroy objects.

For example, when an object is destroyed in RailsMyAdmin, the object's destroy method is called (as opposed to simply deleting the database row), so that any before_destroy and after_destroy hooks are called when the object is destroyed.

Support

This software was developed by Shanti Braford. http://shanti.railsblog.com/

If you enjoyed this plugin or would like to see further development, please recommend me at Working with Rails: http://workingwithrails.com/person/6982-shanti-braford

If you have any comments or questions, please email me at: shantibraford (at) gmail.com

Copyright & License

Copyright (c) 2007 Sprout Systems Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.









Hosted by Google Code