Module: Cms::Behaviors::ClassMethods

Defined in:
lib/cms/behaviors/rendering.rb

Instance Method Summary collapse

Instance Method Details

#helper_classObject


77
78
79
# File 'lib/cms/behaviors/rendering.rb', line 77

def helper_class
  "Cms::#{name}Helper".constantize
end

#helper_pathObject


73
74
75
# File 'lib/cms/behaviors/rendering.rb', line 73

def helper_path
  "app/helpers/#{name.underscore}_helper.rb"
end

#instance_variable_name_for_viewObject

This will be the used as the name of instance variable that will be available in the view. The default value is “@renderable”


69
70
71
# File 'lib/cms/behaviors/rendering.rb', line 69

def instance_variable_name_for_view
  @instance_variable_name_for_view ||= "@renderable"
end

#ivars_to_ignoreObject

Instance variables that will not be copied from the renderable to the view


93
94
95
# File 'lib/cms/behaviors/rendering.rb', line 93

def ivars_to_ignore
  ['@controller', '@_already_rendered']
end

#renderable?Boolean

Returns:

  • (Boolean)

63
64
65
# File 'lib/cms/behaviors/rendering.rb', line 63

def renderable?
  true
end

#template_pathObject

This is where the path to the template. The default is based on the class of the renderable, so if you have an Article that is renderable, the template will be “articles/render”


84
85
86
87
88
89
90
# File 'lib/cms/behaviors/rendering.rb', line 84

def template_path
  path = "#{name.underscore.pluralize}/render"
  if main_app_model?
    path = "cms/#{path}"
  end
  path
end