How to Isolate Formtastic helpers/config to Rails engine?

18 views
Skip to first unread message

Stephen Marsh

unread,
Jun 30, 2015, 3:43:57 PM6/30/15
to rubyonra...@googlegroups.com
Hello...
I would like to use Formtastic and set Formtastic configs inside a Rails Engine, without having those changes to form helpers/config 'leak' into my main application. 

Specifically I am trying to isolate an implementation of Formtastic that is customized for Bootstrap 3 to within my engine, without having the main app's form helpers start using the same markup.

I could specify the ":builder"  option in all my main app's calls to form helpers to override this 'leak', however it would probably be better for the engine's helpers not to leak into the main app in the first place?

Can anyone please offer some insight on how to go about that?

Any help appreciated,
-S

Stephen Marsh

unread,
Jul 1, 2015, 11:42:07 AM7/1/15
to rubyonra...@googlegroups.com
Looks like because Formtastic opens up ActionView and includes its helpers it would be hard to isolate separate implementations of Formtastic between an engine and main app.  So probably the better design would be to set no default builder in the engine whatsoever, and instead explicitly specify the form builders in-line for all calls to semantic_form_for inside the engine.
Reply all
Reply to author
Forward
0 new messages