Sha256: e8554d1764f7a2f04d4d97ece272f21b7eb0f0a82a311c4f9ab036fadbe17738

Contents?: true

Size: 674 Bytes

Versions: 14

Compression:

Stored size: 674 Bytes

Contents

module Routify
  extend ActiveSupport::Concern

 included do
   helper_method :current_namespace, :current_parent, :site_url, :site
   
   def namespaces
     self.class.namespaces
   end
 end

 private
 
 def current_parent
   parent if respond_to?(:parent, true)
 end
 
 def current_namespace
   namespaces.first
 end
  
  def site_url
    'site' if params[:site_id].present?
  end

  def site (current_resource = resource)
    current_resource.site if current_resource.respond_to?(:site)
  end

 module ClassMethods
   def current_namespace
     namespaces.first
   end

   def namespaces
     name.split('::').slice(0...-1).map(&:underscore).map(&:to_s)
   end
 end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
comfortable_mexican_loveseat-0.1.1 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.1.0 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.0.23 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.0.22 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.0.21 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.0.20 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.0.19 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.0.18 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.0.17 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.0.16 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.0.15 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.0.14 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.0.13 app/controllers/concerns/routify.rb
comfortable_mexican_loveseat-0.0.12 app/controllers/concerns/routify.rb