Module: Governor::Controllers::Helpers
- Defined in:
- lib/governor/controllers/helpers.rb
Instance Method Summary collapse
-
#model_class ⇒ Object
Returns the Mapping model class, for example: Article.
-
#resource ⇒ Object
Represents the article for this session.
-
#resource_sym ⇒ Object
Returns a symbol representation of this resource, for example
:article
if the Mapping class is Article. -
#resources ⇒ Object
Returns the list of articles for this session.
Instance Method Details
#model_class ⇒ Object
Returns the Mapping model class, for example: Article.
25 26 27 |
# File 'lib/governor/controllers/helpers.rb', line 25 def model_class @model_class ||= mapping.to end |
#resource ⇒ Object
Represents the article for this session. Can also be accessed as an instance variable, for example @article
if the Mapping class is Article.
7 8 9 |
# File 'lib/governor/controllers/helpers.rb', line 7 def resource instance_variable_get("@#{mapping.singular}") end |
#resource_sym ⇒ Object
Returns a symbol representation of this resource, for example :article
if the Mapping class is Article.
13 14 15 |
# File 'lib/governor/controllers/helpers.rb', line 13 def resource_sym mapping.singular end |
#resources ⇒ Object
Returns the list of articles for this session. Can also be accessed as an instance variable, for example @articles
if the Mapping class is Article.
20 21 22 |
# File 'lib/governor/controllers/helpers.rb', line 20 def resources instance_variable_get("@#{mapping.plural}") end |