Rails DataBrowser

Rails DataBrowser is a Django's Databrowser like for Rails. With it, you can browse, edit, create, view and delete data from your database through your tables, using ActiveRecord. It's a simple plugin that can be also installed as a gem and works on this way:

Install on your Rails App

./script/plugin install git://github.com/milk-it/databrowser.git

Or install it system wide via RubyGems

gem install databrowser

You can also install the development version (the same as the plugin version):

gem install milk-it-databrowser

Add the routes

Add this to your config/routes.rb:

map.databrowser

And it's done! You can now access www.yourapplication.com/databrowser (or localhost:3000/databrowser) and see it working!

Or if you don't want that the DataBrowser's location be /databrowser, you can do:

map.databrowser "db" 

To change the base location of your DataBrowser to /db.

To use DataBrowser in development environment only, you can do:

map.databrowser if RAILS_ENV.eql?("development")

If you installed the Gem, you will need to add:

require 'data_browser'

at the beginning of your routes.rb, or if you use Rails >= 2.1, you can simply add:

  config.gem "databrowser", :lib => "data_browser" 

to your environment.rb!

Configure your models

By default, DataBrowser will map all your tables, if you don't want this, you can configure DataBrowser to map only some tables. For this, create and edit a file config/initializers/data_browser.rb:

[[DataBrowser]].tables = ["users", "messages"] # add all the tables you want to map here

For compatibility reason, you can still use:

[[DataBrowser]].models = [User, Message] # add all the models you want to map here

Remember, if you wants that DataBrowser map all your tables, you don't need the setup above.

Protect your DataBrowser

If you wants to protect it with a username/password, add this to your initializer:

[[DataBrowser]].protect "username", "password" 

Enjoy

That's it! Your DataBrowser is now ready to use! You just need to access /databrowser.

Note: if your server was started before you install or (re)configure DataBrowser, you'll need to restart it.

Screenshots

See the screenshots at DataBrowser's "Open Source Rails" page: http://www.opensourcerails.com/projects/135-Rails-DataBrowser