# File lib/extjs/data/store.rb, line 45
    def render(script_tag = true)
      script = ''
      # ugly hack for DirectProxy API.  Have to add an Ext.onReady() after the Store constructor to set API
      if @proxy === 'direct'
        auto_load = @config.delete("autoLoad")
        cname = @controller.controller_name.capitalize
        script = "Ext.onReady(function() { var s = Ext.StoreMgr.get('#{@config["storeId"]}');"
        if (@config["directFn"])
          script += "s.proxy.directFn = #{cname}.#{@config["directFn"]};"
        else
          script += "s.proxy.setApi({create:#{cname}.#{@config["api"]["create"]},read:#{cname}.#{@config["api"]["read"]},update:#{cname}.#{@config["api"]["update"]},destroy:#{cname}.#{@config["api"]["destroy"]}});"
        end
        if auto_load
          script += "s.load();"
        end
        script += "});"
      end

      if @writer  # <-- ugly hack because 3.0.1 can't deal with Writer as config-param
        json = @config.to_json
        json[json.length-1] = ','
        json += "\"writer\":new Ext.data.#{@format.capitalize}Writer(#{@writer.to_json})}"
        "<script>new #{@type}(#{json});#{script}</script>"
      else
        "<script>new #{@type}(#{@config.to_json});#{script}</script>"
      end
    end