This gem is a set of helpers to support archetype-based apprach to share controllers and views behaviours with Inherited Resources.
Add do Gemfile
gem 'archetype', :git => 'git://github.com/tb/archetype.git' gem 'inherited_resources_archetypes', :git => 'git://github.com/tb/inherited_resources_archetypes.git'
Create an initializer with following code:
Archetype::Base.register_archetype :crud do append_view_path Archetype::Resolver::Rails.new("archetype/crud") append_view_path InheritedResourcesArchetypes::Resolver::Engine.new("archetype/crud") inherit_resources include Archetype::Helpers::InheritedResources include Archetype::Helpers::InheritedResources::OnUpdateSuccessRedirectToEdit include Archetype::Helpers::InheritedResources::OnCreateSuccessRedirectToEdit end
Now you can define your controller to use ‘crud’ archetype like this:
class UsersController < ApplicationController archetype :crud end
* implement 5-7 archetypes & views * document archetypes + ilustrate them with pictures * publish some example Rails engines that use archetypes
Copyright © 2011 Tomasz Bąk, released under the MIT license