     html_options
 
   __protect_against_forgery: false
+  __request_forgery_protection_token: 'form_token'
   __form_authenticity_token: 'secret'
-  __request_forgery_protection_token: 'form_token'
+
+  __init_request_forgery_protection: ->
+    param = $('head meta[name="csrf-param"]').attr('content')
+    token = $('head meta[name="csrf-token"]').attr('content')
+    if param and token
+      @__protect_against_forgery = true
+      @__request_forgery_protection_token = param
+      @__form_authenticity_token = token
 
   _token_tag: (token = @__form_authenticity_token) ->
     if token isnt false and @__protect_against_forgery

      else
        Ultimate.Helpers.Tag.content_tag('span', name ? url, html_options, false)
    else
      @link_to arguments...

  # TODO tests
  link_to_unless_current: (name, options = {}, html_options = {}, block = null) ->

#= require ./javascript

__char_encode = (char) -> "%#{char.charCodeAt(0).toString(16)}"
__escape_path = (str) -> str.replace(/[^*\-.0-9A-Z_a-z]/g, __char_encode).replace(/\+/g, '%20')
__string_encode = (str) -> _.map(str, (char) -> "&##{char.charCodeAt(0)};" ).join('')

@Ultimate.Helpers.Url =
