Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/page_routes.rb

Instance Method Summary collapse

Instance Method Details

#globalize_hierarchical_resource(scope, locales, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/page_routes.rb', line 3

def globalize_hierarchical_resource(scope,locales,options = {})
  mount Mercury::Engine => options[:mercury] || "/" if options[:mercury] != false
  if Amalgam.i18n == 'param'
    scope "(:locale)", :locale => locales do
      get "/#{scope.to_s}/*slug" => "#{scope.to_s}#show" , :as => scope.to_s.singularize.to_sym
    end
  end
  get "/#{scope.to_s}/*slug" => "#{scope.to_s}#show" , :as => scope.to_s.singularize.to_sym, :constraints => { :subdomain => locales } if Amalgam.i18n == 'subdomain'
end

#hierarchical_resource(scope, options = {}) ⇒ Object



13
14
15
16
# File 'lib/page_routes.rb', line 13

def hierarchical_resource(scope,options = {})
  mount Mercury::Engine => options[:mercury] || "/" if options[:mercury] != false
  get "/#{scope.to_s}/*slug" => "#{scope.to_s}#show" , :as => scope.to_s.singularize.to_sym
end