Wallaby is a Rails engine that autocompletes the resourceful controller and view for a given ORM model (ActiveRecord, HER) for admin interface and other purposes.
It can be extended to support any ORM model and can be easily and deeply customized at MVC's different aspects by using decorators, controllers, type partials, servicers, authorizers, paginators and themes.
Install
Add Wallaby to Gemfile
.
# Gemfile
gem 'wallaby'
And re-bundle.
bundle install
Basic Usage
As Admin Interface
Just mount Wallaby engine to desired path, e.g. /admin
in config/routes.rb
.
# config/routes.rb
mount Wallaby::Engine, at: '/admin'
Or run installer to generate default application classes/templates under namespace e.g. Admin
and mount Wallaby engine to path /admin
.
rails g wallaby:install admin
Restart rails server, and visit http://localhost:3000/admin to start exploring!
For General Purposes
Instead of using Rails scaffold generator to generate all the boilerplate code, Wallaby can help to quickly get the pages up for ordinary resourceful actions.
For example, if a model Blog
is generated:
rails generate model blog title:string body:text
rails db:migrate
There are two ways to spin up things, choose what fits best:
-
add resources route to
config/routes.rb
usingwresources
helper without any needs of customization# config/routes.rb wresources :blogs, controller: 'wallaby/resources'
-
add blogs controller for later customization
# app/controllers/blogs_controller.rb class BlogsController < Wallaby::ResourcesController end
then add corresponding resources route using origin Rails
resources
helper# config/routes.rb resources :blogs
Restart rails server, and visit http://localhost:3000/blogs to give it a taste!
Documentation
- Features and Requirements
- Documentation for more usages and customization guides
- API Reference
- Change Logs
Want to contribute?
Raise an issue, discuss and resolve!
License
This project uses MIT License.