Module: Globalize2::SiteControllerExtensions

Defined in:
lib/globalize2/site_controller_extensions.rb

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/globalize2/site_controller_extensions.rb', line 3

def self.included(base)
  base.send(:include, InstanceMethods)
  base.class_eval do
    alias_method_chain :find_page, :globalize
    before_filter :set_locale
  end
end

Instance Method Details

#find_page_with_globalize(url) ⇒ Object



19
20
21
22
23
24
# File 'lib/globalize2/site_controller_extensions.rb', line 19

def find_page_with_globalize(url)
  if Globalize2Extension.locales.size > 1 && url[/css|js/].nil?
    url = '/' + I18n.locale.to_s + '/' + url
  end
  find_page_without_globalize(url)
end