Class: ActionController::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/active_helper/rails.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.active_helper(*classes) ⇒ Object

The passed helpers will be imported in the view and thus be available in your template.

Example:

class BeerController < ActionController::Base
  active_helper ThirstyHelper

The helper file usually resides in app/active_helpers/, baby.



15
16
17
# File 'lib/active_helper/rails.rb', line 15

def active_helper(*classes)
  active_helpers.push(*classes).uniq!
end

Instance Method Details

#initialize_template_class_with_active_helper(response) ⇒ Object



20
21
22
23
# File 'lib/active_helper/rails.rb', line 20

def initialize_template_class_with_active_helper(response)
  initialize_template_class_without_active_helper(response)
  response.template.import *self.class.active_helpers
end