Module: Georgia::Concerns::Helpers
- Extended by:
- ActiveSupport::Concern
- Included in:
- PagesController
- Defined in:
- app/controllers/georgia/concerns/helpers.rb
Instance Method Summary collapse
Instance Method Details
#instance_name ⇒ Object
13 14 15 |
# File 'app/controllers/georgia/concerns/helpers.rb', line 13 def instance_name controller_name.singularize end |
#model ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/controllers/georgia/concerns/helpers.rb', line 17 def model begin self.class.to_s.gsub(/Controller/,'').singularize.constantize # If no constant is found, check if the non-namespaced one exists. i.e. Partner => Admin::PartnersController rescue NameError self.class.to_s.gsub(/Controller/,'').gsub(/\w+::/,'').singularize.constantize end end |