Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: e29b25ed50
Fetching contributors…

Cannot retrieve contributors at this time

65 lines (47 sloc) 2.508 kB
ABOUT PLUGIN
=======================
This is a plugin to manage your models using browser.
FEATURES
===========================
Browse table records.
For each individual record a snapshot of all association records is shown. Currently the associations that
are supported are has_many, belongs_to and has_one. Next to the association name, a count of number of
associated records is shown. All the associated records are link so you can jump from record to record. If
an associated record is not present then there will be no link.
Quick search across all records in the table.
Advance search including all columns of table.
Browse migration records from the table even though there is no corresponding model for it.
Add a new record (persmission check enforced)
Edit an existing record (persmission check enforced)
Delete an existing record (persmission check enforced and no callbacks)
Destroy an existing record (persmission check enforced and callbacks will be invoked)
All the features are povided without using named_scope. So no new method is added to the model. It is
totally non-intrusive from that point of view.
LIVE DEMO
===============
http://www.neeraj.name/admin_model
Note that in the demo you will be accessing only features available for read only. You will not be
able to update/delete/create any record.
HOW TO INSTALL THIS PLUGIN
==========================
> ruby script/plugin install git://github.com/neerajdotname/roll_admin_model.git
HOW TO USE IT
======================
After installing the plugin you need to put following lines of code in config/routes.rb at the very top
RollAdminModel::Routing.connect_with map
Now go to http://localhost:3000/admin_model
SECURING IT
=============================
This plugin will allow access to browse the models without any authorization check in development and test environment.
However in other environments a security check is enforced. Given below is one way to ensure authentication. Put the following
four lines of code in an initializer at ~/config/initializers/roll_admin_model.rb
# authorization check to access the controller
ROLL_ADMIN_MODEL_AUTH = Proc.new { |controller| controller.send("admin_logged_in?") }
# If you want updates to be allowed then set this constant as true
ROLL_ADMIN_MODEL_UPDATE_ALLOWED = false
TESTED WITH
======================
I have tested this plugin with MySQL and PostgreSQL.
FEEDBACK
======================
Please submit your feedback to neerajdotname [AT] gmail [DOT] com
Jump to Line
Something went wrong with that request. Please try again.