Class: Segments::Engine
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- Segments::Engine
- Defined in:
- lib/engine.rb
Class Method Summary collapse
Class Method Details
.activate ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/engine.rb', line 5 def self.activate Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c| Rails.env.production? ? require(c) : load(c) end ActionView::Rendering.module_eval do def render_segment(segment_name = "") segment = Segment.find_by_key_and_locale( segment_name, I18n.locale ) render :text => segment.content.html_safe if segment end end end |