Sha256: 654897205470363bacf00089644ae62a0eee6e571f79e172b36d22389fab29c8
Contents?: true
Size: 665 Bytes
Versions: 10
Compression:
Stored size: 665 Bytes
Contents
require 'active_support/concern' module Georgia module Concerns module Helpers extend ActiveSupport::Concern included do helper_method :instance_name helper_method :model end def instance_name controller_name.singularize end 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 end end end
Version data entries
10 entries across 10 versions & 1 rubygems