Sha256: 7be567099fff05b6c0138cc1eb6465b36cc0d852cf7e765163f6896724513ae6

Contents?: true

Size: 592 Bytes

Versions: 1

Compression:

Stored size: 592 Bytes

Contents

module Rewritten
  module Document

    def rewritten_url=(new_translation)
      Rewritten.add_translation(new_translation, url_for(self)) 
    end

    def rewritten_url
      return "" unless persisted? 
      Rewritten.get_current_translation(url_for(self))
    end

    def rewritten_urls
      return [] unless persisted? 
      Rewritten.get_all_translations(url_for(self))
    end

    def has_rewritten_url?
      Rewritten.exist_translation_for?(url_for(self))
    end
    
    def remove_rewritten_urls
      Rewritten.remove_all_translations(url_for(self))
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rewritten-0.12.0 lib/rewritten/document.rb