An open API service indexing awesome lists of open source software.

https://github.com/tb/inherited_resources_archetypes

InheritedResources archetypes modules
https://github.com/tb/inherited_resources_archetypes

Last synced: over 1 year ago
JSON representation

InheritedResources archetypes modules

Awesome Lists containing this project

README

          

= Inherited Resources Archetypes

This gem is a set of helpers to support archetype-based apprach
to share controllers and views behaviours with Inherited Resources.

= Installation

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'

= Usage

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

= TODO

* implement 5-7 archetypes & views
* document archetypes + ilustrate them with pictures
* publish some example Rails engines that use archetypes

Copyright (c) 2011 Tomasz Bąk, released under the MIT license