Sha256: 87367d47a7ad8ca1522cb9f7923cb1ade3b91ba8e23ca5f31f27bbb0ddfd80aa
Contents?: true
Size: 829 Bytes
Versions: 9
Compression:
Stored size: 829 Bytes
Contents
module Cell::ActiveHelper def self.included(base) base.extend ClassMethods base.class_inheritable_array :active_helpers base.active_helpers = [] end module ClassMethods # The passed helpers will be imported in the view and thus be available in # your template. # # Example: # class BassistCell < Cell::Base # active_helper SlappingHelper # # The helper file usually resides in +app/active_helpers/+, baby. def active_helper(*classes) active_helpers.push(*classes).uniq! end end def import_active_helpers_into(view) return if self.class.active_helpers.blank? # We simply assume if somebody's using #active_helper, it is already # required. view.extend ::ActiveHelper view.use *self.class.active_helpers end end
Version data entries
9 entries across 9 versions & 1 rubygems