Reputation: 5983
I have a large number of views in my Rails application that both:
As such, I would like to write these views directly in Ruby (using a DSL/helpers that I would write).
How can I get Rails to allow me to write .html.rb
views?
Thanks!
Upvotes: 1
Views: 326
Reputation: 5983
Add an initializer with:
ActionView::Template.register_template_handler(:rb, :source.to_proc)
Then you can write .html.rb
views in ruby, they should return a String
of the desired context when executed.
Upvotes: 3