Module: Governor::Controllers::Helpers

Defined in:
lib/governor/controllers/helpers.rb

Instance Method Summary collapse

Instance Method Details

#model_classObject

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

#resourceObject

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_symObject

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

#resourcesObject

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