Module: Hammock::RestfulSupport::ClassMethods
- Defined in:
- lib/hammock/restful_support.rb
Instance Method Summary collapse
-
#mdl ⇒ Object
The model this controller operates on.
-
#mdl_name ⇒ Object
The lowercase name of the model this controller operates on.
Instance Method Details
#mdl ⇒ Object
The model this controller operates on. Defined as the singularized controller name. For example, for GelatinousBlobsController
, this will return the GelatinousBlob
class.
21 22 23 |
# File 'lib/hammock/restful_support.rb', line 21 def mdl @hammock_cached_mdl ||= Object.const_get to_s.sub('Controller', '').classify end |
#mdl_name ⇒ Object
The lowercase name of the model this controller operates on. For example, for GelatinousBlobsController
, this will return “gelatinous_blob”.
25 26 27 |
# File 'lib/hammock/restful_support.rb', line 25 def mdl_name @hammock_cached_mdl_name ||= to_s.sub('Controller', '').singularize.underscore end |