Module: Dragoman::MapperRails3::MappingRails3

Defined in:
lib/dragoman/mapper_rails3.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



16
17
18
# File 'lib/dragoman/mapper_rails3.rb', line 16

def self.included(base)
  base.send :alias_method_chain, :to_route, :localization
end

Instance Method Details

#to_route_with_localizationObject



20
21
22
23
24
25
26
27
# File 'lib/dragoman/mapper_rails3.rb', line 20

def to_route_with_localization
  if @options[:locale]
    Dragoman::UrlHelpers.add_untranslated_helpers @options[:as], @set.named_routes.module, @set.named_routes.module if @options[:as]
    @options[:as] = "#{@options[:as]}_#{@options[:locale]}" if @options[:as].present?
    @options[:as] = nil if @options[:as] && @set.named_routes.routes[@options[:as].to_sym] # TODO: why do we need to set as to nil?
  end
  to_route_without_localization
end