# File lib/js_routes.rb, line 124
  def generate
    # Ensure routes are loaded. If they're not, load them.
    if named_routes.to_a.empty? && application.respond_to?(:reload_routes!)
      application.reload_routes!
    end

    {
      "GEM_VERSION"         => JsRoutes::VERSION,
      "ROUTES"              => js_routes,
      "DEPRECATED_BEHAVIOR" => Rails.version < "4",
      "NODE_TYPES"          => json(NODE_TYPES),

      "APP_CLASS"           => application.class.to_s,
      "NAMESPACE"           => json(@configuration.namespace),
      "DEFAULT_URL_OPTIONS" => json(@configuration.default_url_options),
      "PREFIX"              => json(@configuration.prefix),
      "SPECIAL_OPTIONS_KEY" => json(@configuration.special_options_key),
      "SERIALIZER"          => @configuration.serializer || json(nil),
    }.inject(File.read(File.dirname(__FILE__) + "/routes.js")) do |js, (key, value)|
      js.gsub!(key, value.to_s)
    end
  end