Skip to main content
100%

Gist 9838421

✓ Published0🌍 Public
Aafbroman
Last edited Feb 24, 2011
Created on Mar 28, 2014

This example shows a Ruby on Rails module called Conducer that combines the conductor and presenter patterns into a model capable of generating view-centric methods. The code defines a `Base` class inheriting from `ActiveRecord::Base` and provides factory methods like `Conducer.for` to dynamically create model classes with specified table names and behaviors. It integrates Rails routing helpers and ActionView helpers, while using `ActionDispatch::TestRequest` and `TestResponse` to mock a controller when none is provided. The module also extends `ActiveRecord::Base` with a `base` method for creating subclasses and adds autoload paths for conducer files.

AI-generated description

Similar vizzes