Just ready for the great new Rails 3, this open source generator for DRY and specifically extendable CRUD components removes even more duplication from your Ruby on Rails applications.
We Open the Source
After several years of Ruby on Rails
development, it’s time to give something back to the community.
dry_crud has its origins in a
couple of projects developed here at Puzzle ITC and was now extracted
and refined as a re-usable, open source component. Version 1.0.0 is fully compatible with the shiny new Rails 3.
dry_crud is a Rails generator. It generates a
specifically extendable controller, views and helpers for the CRUD
(create, read, update and delete) functionality of your application.
Since the look and feel of these parts should be consistent throughout
the entire application, you want to define it once and use it
everywhere. In other words, you want to keep it all DRY (Don’t repeat
yourself). Because dry_crud is a generator, you get a good foundation
to start with but you are free (if not encouraged!) to modify
everything to exactly fit your needs.
Don’t we already have that?
There is Rails scaffolding, Active
Scaffold or Dry
Scaffold. While the first one
generates the same (and not really production ready) code over and over again, the latter already reduce
duplication to a fair amount. Still, own views have to be reproduced
for each model. This creates quite a bit of maintenance effort if you
want to include a new feature, like, e.g., pagination. Based on the
extension (released as a stand-alone Rails plugin as well), views may
be ‘inherited’ to subclasses of a given controller.
Therefore, the views may just be defined once and be reused for every
model that requires CRUD. Thanks to the helpers included in dry_crud,
the displayed forms and tables will automatically adapt to the actual
model attributes. If these default views do not meet all requirements,
it is possible to customize specific parts for arbitrary models. Of
course, the same is true for the generated CRUD controller.
Please find more details, documentation, examples and the source code
at the GitHub page of the project.
The latest version is built for Rails 3. If you would like to use
dry_crud with Rails 2.3, please install version 0.6.0.