envato-archive / guide

Document your application with a living component library and styleguide
https://rubygems.org/gems/guide
MIT License
8 stars 3 forks source link

Allow applications to inject helpers if they refuse to live without them #26

Closed lukearndt closed 8 years ago

lukearndt commented 8 years ago

View models are definitely the preferred way to push data to templates.

However, sometimes the host application will call a helper method in a template. Sometimes it's for a legitimate reason - perhaps the helper method does some html manipulation that would be inappropriate in the backend. Sometimes it's a symptom of legacy code. Either way, it would be kind of us to provide some basic support for it.

This change allows the host application to supply the name of a module as a configuration value. This module will be included into the ApplicationHelper of the Guide gem, making the corresponding helper methods available to templates.

lukearndt commented 8 years ago

Confirmed as working, by the way. I pointed my local Envato Market at this branch and it's letting me inject helpers.

ppj commented 8 years ago

looks legit to me :+1: