Loading ...
Sorry, an error occurred while loading the content.

Re: Cara send_file di Ruby?

Expand Messages
  • lyoneil_de_sire
    lho sebentar.. errornya NoMethodError for ActionController::DataStreaming:Module ? berarti si send_file nya sendiri mah ketemu yah.. karena dia tau kalo yg
    Message 1 of 26 , Oct 10, 2012
    • 0 Attachment
      lho sebentar..

      errornya "NoMethodError for ActionController::DataStreaming:Module"?

      berarti si send_file nya sendiri mah ketemu yah.. karena dia tau kalo yg kita maksud tuh ada di ActionController::DataStreaming .. yg error tuh ditempat lain.. bisa copy paste full error messages nya?
    • Iqbal Farabi
      Hmm.. jadi gini sih, Di file el_finer/connector.rb ada module ElFinder dan class Connector. Ketika saya coba gunakan send_file dengan plain saja, pesan
      Message 2 of 26 , Oct 10, 2012
      • 0 Attachment
        Hmm.. jadi gini sih,

        Di file el_finer/connector.rb ada module ElFinder dan class Connector.
        Ketika saya coba gunakan send_file dengan plain saja, pesan errornya adalah
        NoMethodError for class ElFinder::Connector. Lalu saya ubek-ubek sedikit
        source code Rails, dan ketemu bahwa send_file ini adanya di
        ActionController::DataStreaming (yg mana ini adalah sebuah module). Nah,
        pesan error itu terjadi karena saya coba panggil dengan cara seperti ini
        (sepertinya cara saya agak silly :D):

        1. Di file utama el_finder.rb saya tambahkan
        require 'action_controller/metal/data_streaming'

        2. Pada file el_finder/connector.rb saya buat method baru untuk download,
        disitu saya pnggil send_file:
        send_file('nama_file')

        3. Pesan error:

        Started GET "/elfinder?cmd=download&target=bG9nb3MvZWxmaW5kZXIucG5n" for
        127.0.0.1 at 2012-10-10 19:10:47 +0800
        Processing by HomeController#elfinder as HTML
        Parameters: {"cmd"=>"download", "target"=>"bG9nb3MvZWxmaW5kZXIucG5n"}
        Completed 500 Internal Server Error in 2ms

        NoMethodError (undefined method `send_file' for
        #<ElFinderQbl::Connector:0x00000003ce43e0>):
        app/controllers/home_controller.rb:7:in `elfinder'

        4. Sementara, source code dari Rails untuk send_file ada di sini
        https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/data_streaming.rb


        Terimakasih lho buat bantuan rekan-rekan semua. :)


        2012/10/11 lyoneil_de_sire <lyoneil_de_sire@...>

        > **
        >
        >
        > lho sebentar..
        >
        > errornya "NoMethodError for ActionController::DataStreaming:Module"?
        >
        > berarti si send_file nya sendiri mah ketemu yah.. karena dia tau kalo yg
        > kita maksud tuh ada di ActionController::DataStreaming .. yg error tuh
        > ditempat lain.. bisa copy paste full error messages nya?
        >
        >
        >



        --
        Iqbal Farabi
        CMO of Starqle Indonesia (iqbal@...)
        Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
        farabi.iqbal@...


        [Non-text portions of this message have been removed]
      • tejanium
        Mungkin begini, jangan di require di lib/el_finder.rb tapi di include di dalem kelas Connectornya di lib/el_finder/connector.rb jadi begini module ElFinder
        Message 3 of 26 , Oct 11, 2012
        • 0 Attachment
          Mungkin begini, jangan di require di lib/el_finder.rb tapi di include di dalem kelas Connectornya di lib/el_finder/connector.rb

          jadi begini


          module ElFinder

            # Represents ElFinder connector on Rails side.
            class Connector
          include ActionController::DataStreaming

          ...

          end
          end
          itu jg kalo udah ke load ActionController-nya

          kalo gak mau ribed, cukup modifikasi header, sama header sama contentnya aja seperti yang mas Nugroho bilang

          itu kan ada tuh di kelas Connector, @header sama @response, tambahin aja disana

          CMIIW..

          ________________________________
          From: Iqbal Farabi <farabi.iqbal@...>
          To: id-ruby@yahoogroups.com
          Sent: Thursday, October 11, 2012 1:59 PM
          Subject: Re: [id-ruby] Re: Cara send_file di Ruby?

          Hmm.. jadi gini sih,

          Di file el_finer/connector.rb ada module ElFinder dan class Connector.
          Ketika saya coba gunakan send_file dengan plain saja, pesan errornya adalah
          NoMethodError for class ElFinder::Connector. Lalu saya ubek-ubek sedikit
          source code Rails, dan ketemu bahwa send_file ini adanya di
          ActionController::DataStreaming (yg mana ini adalah sebuah module). Nah,
          pesan error itu terjadi karena saya coba panggil dengan cara seperti ini
          (sepertinya cara saya agak silly :D):

          1. Di file utama el_finder.rb saya tambahkan
          require 'action_controller/metal/data_streaming'

          2. Pada file el_finder/connector.rb saya buat method baru untuk download,
          disitu saya pnggil send_file:
          send_file('nama_file')

          3. Pesan error:

          Started GET "/elfinder?cmd=download&target=bG9nb3MvZWxmaW5kZXIucG5n" for
          127.0.0.1 at 2012-10-10 19:10:47 +0800
            Processing by HomeController#elfinder as HTML
            Parameters: {"cmd"=>"download", "target"=>"bG9nb3MvZWxmaW5kZXIucG5n"}
          Completed 500 Internal Server Error in 2ms

          NoMethodError (undefined method `send_file' for
          #<ElFinderQbl::Connector:0x00000003ce43e0>):
            app/controllers/home_controller.rb:7:in `elfinder'

          4. Sementara, source code dari Rails untuk send_file ada di sini
          https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/data_streaming.rb


          Terimakasih lho buat bantuan rekan-rekan semua. :)


          2012/10/11 lyoneil_de_sire <lyoneil_de_sire@...>

          > **
          >
          >
          > lho sebentar..
          >
          > errornya "NoMethodError for ActionController::DataStreaming:Module"?
          >
          > berarti si send_file nya sendiri mah ketemu yah.. karena dia tau kalo yg
          > kita maksud tuh ada di ActionController::DataStreaming .. yg error tuh
          > ditempat lain.. bisa copy paste full error messages nya?
          >

          >



          --
          Iqbal Farabi
          CMO of Starqle Indonesia (iqbal@...)
          Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
          farabi.iqbal@...


          [Non-text portions of this message have been removed]



          ------------------------------------

          ID-Ruby
          Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)

              http://rubyurl.com/Q8DD
              http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia




          [Non-text portions of this message have been removed]
        • Giovanni Sakti
          baru tune in nih.. setuju pakai modifikasi response header.. ada beberapa yang nulis, ini nemu barusan:
          Message 4 of 26 , Oct 11, 2012
          • 0 Attachment
            baru tune in nih..
            setuju pakai modifikasi response header..

            ada beberapa yang nulis, ini nemu barusan: http://thedataasylum.com/articles/how-rails-nginx-x-accel-redirect-work-together.html

            jadi si gem el_finder ga perlu di modifikasi, controller cukup terima path file yang mau di download dari si elfinder (sory ga familiar sama plugin/gemnya, tapi si elfinder harusnya bisa kirim path file yang mau di download ke rails lagi kan?)

            --
            Giovanni Sakti
            Starqle Indonesia
            http://www.starqle.com


            On Thursday, October 11, 2012 at 2:17 PM, tejanium wrote:

            >
            > Mungkin begini, jangan di require di lib/el_finder.rb tapi di include di dalem kelas Connectornya di lib/el_finder/connector.rb
            >
            > jadi begini
            >
            > module ElFinder
            >
            > # Represents ElFinder connector on Rails side.
            > class Connector
            > include ActionController::DataStreaming
            >
            > ...
            >
            > end
            > end
            > itu jg kalo udah ke load ActionController-nya
            >
            > kalo gak mau ribed, cukup modifikasi header, sama header sama contentnya aja seperti yang mas Nugroho bilang
            >
            > itu kan ada tuh di kelas Connector, @header sama @response, tambahin aja disana
            >
            > CMIIW..
            >
            > ________________________________
            > From: Iqbal Farabi <farabi.iqbal@... (mailto:farabi.iqbal%40gmail.com)>
            > To: id-ruby@yahoogroups.com (mailto:id-ruby%40yahoogroups.com)
            > Sent: Thursday, October 11, 2012 1:59 PM
            > Subject: Re: [id-ruby] Re: Cara send_file di Ruby?
            >
            > Hmm.. jadi gini sih,
            >
            > Di file el_finer/connector.rb ada module ElFinder dan class Connector.
            > Ketika saya coba gunakan send_file dengan plain saja, pesan errornya adalah
            > NoMethodError for class ElFinder::Connector. Lalu saya ubek-ubek sedikit
            > source code Rails, dan ketemu bahwa send_file ini adanya di
            > ActionController::DataStreaming (yg mana ini adalah sebuah module). Nah,
            > pesan error itu terjadi karena saya coba panggil dengan cara seperti ini
            > (sepertinya cara saya agak silly :D):
            >
            > 1. Di file utama el_finder.rb saya tambahkan
            > require 'action_controller/metal/data_streaming'
            >
            > 2. Pada file el_finder/connector.rb saya buat method baru untuk download,
            > disitu saya pnggil send_file:
            > send_file('nama_file')
            >
            > 3. Pesan error:
            >
            > Started GET "/elfinder?cmd=download&target=bG9nb3MvZWxmaW5kZXIucG5n" for
            > 127.0.0.1 at 2012-10-10 19:10:47 +0800
            > Processing by HomeController#elfinder as HTML
            > Parameters: {"cmd"=>"download", "target"=>"bG9nb3MvZWxmaW5kZXIucG5n"}
            > Completed 500 Internal Server Error in 2ms
            >
            > NoMethodError (undefined method `send_file' for
            > #<ElFinderQbl::Connector:0x00000003ce43e0>):
            > app/controllers/home_controller.rb:7:in `elfinder'
            >
            > 4. Sementara, source code dari Rails untuk send_file ada di sini
            > https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/data_streaming.rb
            >
            > Terimakasih lho buat bantuan rekan-rekan semua. :)
            >
            > 2012/10/11 lyoneil_de_sire <lyoneil_de_sire@... (mailto:lyoneil_de_sire%40yahoo.com)>
            >
            > > **
            > >
            > >
            > > lho sebentar..
            > >
            > > errornya "NoMethodError for ActionController::DataStreaming:Module"?
            > >
            > > berarti si send_file nya sendiri mah ketemu yah.. karena dia tau kalo yg
            > > kita maksud tuh ada di ActionController::DataStreaming .. yg error tuh
            > > ditempat lain.. bisa copy paste full error messages nya?
            > >
            > >
            > >
            >
            > --
            > Iqbal Farabi
            > CMO of Starqle Indonesia (iqbal@... (mailto:iqbal%40starqle.com))
            > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
            > farabi.iqbal@... (mailto:farabi.iqbal%40gmail.com)
            >
            > [Non-text portions of this message have been removed]
            >
            > ------------------------------------
            >
            > ID-Ruby
            > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
            >
            > http://rubyurl.com/Q8DD
            > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
            >
            > [Non-text portions of this message have been removed]
            >
            >



            [Non-text portions of this message have been removed]
          • Iqbal Farabi
            I see. Dicoba dulu deh, karena memang yg alternatif ini belum saya coba sama sekali. Thanks all. Nanti saya report lagi hasilnya gimana. 2012/10/11 Giovanni
            Message 5 of 26 , Oct 11, 2012
            • 0 Attachment
              I see. Dicoba dulu deh, karena memang yg alternatif ini belum saya coba
              sama sekali. Thanks all. Nanti saya report lagi hasilnya gimana.

              2012/10/11 Giovanni Sakti <giosakti@...>

              > **
              >
              >
              > baru tune in nih..
              > setuju pakai modifikasi response header..
              >
              > ada beberapa yang nulis, ini nemu barusan:
              > http://thedataasylum.com/articles/how-rails-nginx-x-accel-redirect-work-together.html
              >
              > jadi si gem el_finder ga perlu di modifikasi, controller cukup terima path
              > file yang mau di download dari si elfinder (sory ga familiar sama
              > plugin/gemnya, tapi si elfinder harusnya bisa kirim path file yang mau di
              > download ke rails lagi kan?)
              >
              > --
              > Giovanni Sakti
              > Starqle Indonesia
              > http://www.starqle.com
              >
              >
              > On Thursday, October 11, 2012 at 2:17 PM, tejanium wrote:
              >
              > >
              > > Mungkin begini, jangan di require di lib/el_finder.rb tapi di include di
              > dalem kelas Connectornya di lib/el_finder/connector.rb
              > >
              > > jadi begini
              > >
              > > module ElFinder
              > >
              > > # Represents ElFinder connector on Rails side.
              > > class Connector
              > > include ActionController::DataStreaming
              > >
              > > ...
              > >
              > > end
              > > end
              > > itu jg kalo udah ke load ActionController-nya
              > >
              > > kalo gak mau ribed, cukup modifikasi header, sama header sama contentnya
              > aja seperti yang mas Nugroho bilang
              > >
              > > itu kan ada tuh di kelas Connector, @header sama @response, tambahin aja
              > disana
              > >
              > > CMIIW..
              > >
              > > ________________________________
              > > From: Iqbal Farabi <farabi.iqbal@... (mailto:
              > farabi.iqbal%40gmail.com)>
              > > To: id-ruby@yahoogroups.com (mailto:id-ruby%40yahoogroups.com)
              > > Sent: Thursday, October 11, 2012 1:59 PM
              > > Subject: Re: [id-ruby] Re: Cara send_file di Ruby?
              > >
              > > Hmm.. jadi gini sih,
              > >
              > > Di file el_finer/connector.rb ada module ElFinder dan class Connector.
              > > Ketika saya coba gunakan send_file dengan plain saja, pesan errornya
              > adalah
              > > NoMethodError for class ElFinder::Connector. Lalu saya ubek-ubek sedikit
              > > source code Rails, dan ketemu bahwa send_file ini adanya di
              > > ActionController::DataStreaming (yg mana ini adalah sebuah module). Nah,
              > > pesan error itu terjadi karena saya coba panggil dengan cara seperti ini
              > > (sepertinya cara saya agak silly :D):
              > >
              > > 1. Di file utama el_finder.rb saya tambahkan
              > > require 'action_controller/metal/data_streaming'
              > >
              > > 2. Pada file el_finder/connector.rb saya buat method baru untuk download,
              > > disitu saya pnggil send_file:
              > > send_file('nama_file')
              > >
              > > 3. Pesan error:
              > >
              > > Started GET "/elfinder?cmd=download&target=bG9nb3MvZWxmaW5kZXIucG5n" for
              > > 127.0.0.1 at 2012-10-10 19:10:47 +0800
              > > Processing by HomeController#elfinder as HTML
              > > Parameters: {"cmd"=>"download", "target"=>"bG9nb3MvZWxmaW5kZXIucG5n"}
              > > Completed 500 Internal Server Error in 2ms
              > >
              > > NoMethodError (undefined method `send_file' for
              > > #<ElFinderQbl::Connector:0x00000003ce43e0>):
              > > app/controllers/home_controller.rb:7:in `elfinder'
              > >
              > > 4. Sementara, source code dari Rails untuk send_file ada di sini
              > >
              > https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/data_streaming.rb
              > >
              > > Terimakasih lho buat bantuan rekan-rekan semua. :)
              > >
              > > 2012/10/11 lyoneil_de_sire <lyoneil_de_sire@... (mailto:
              > lyoneil_de_sire%40yahoo.com)>
              >
              > >
              > > > **
              > > >
              > > >
              > > > lho sebentar..
              > > >
              > > > errornya "NoMethodError for ActionController::DataStreaming:Module"?
              > > >
              > > > berarti si send_file nya sendiri mah ketemu yah.. karena dia tau kalo
              > yg
              > > > kita maksud tuh ada di ActionController::DataStreaming .. yg error tuh
              > > > ditempat lain.. bisa copy paste full error messages nya?
              > > >
              > > >
              > > >
              > >
              > > --
              > > Iqbal Farabi
              > > CMO of Starqle Indonesia (iqbal@... (mailto:iqbal%40starqle.com
              > ))
              >
              > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
              > > farabi.iqbal@... (mailto:farabi.iqbal%40gmail.com)
              >
              > >
              > > [Non-text portions of this message have been removed]
              > >
              > > ------------------------------------
              > >
              > > ID-Ruby
              > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala
              > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
              > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
              > >
              > > http://rubyurl.com/Q8DD
              > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
              > >
              > > [Non-text portions of this message have been removed]
              > >
              > >
              >
              > [Non-text portions of this message have been removed]
              >
              >
              >



              --
              Iqbal Farabi
              CMO of Starqle Indonesia (iqbal@...)
              Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
              farabi.iqbal@...


              [Non-text portions of this message have been removed]
            • Yacobus Reinhart
              hmm,, jangan dilukai Nginx atau Webserver nya, dia gak salah apa2, coba metode ini: # sebelumnya hilangkan dulu require2 atau include2 yang di tambal sulam
              Message 6 of 26 , Oct 11, 2012
              • 0 Attachment
                hmm,, jangan dilukai Nginx atau Webserver nya, dia gak salah apa2, coba
                metode ini:
                # sebelumnya hilangkan dulu require2 atau include2 yang di tambal sulam
                sebelumnya,
                # dan lebih baik kita bikin method serupa dengan send_file dan send_data

                # ini buat di connector.rb nya
                # Saya menganggap kalo @target adalah file
                def _download
                @response[:content] = @...
                @headers['Content-Type'] = 'application/octet-stream'
                @headers['Content-Disposition'] = 'attachment'
                @headers['Content-Location'] = @..._filename
                @headers['Content-Transfer-Encoding'] = 'binary'
                @headers['Content-Length'] = @response[:content].size
                @headers['Connection'] = 'close'
                end

                # Percobaan berikut untuk di action.rb nya.
                #percobaan: 1
                def el_finder(name = :elfinder, &block)
                self.send(:define_method, name) do
                h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)
                headers.merge!(h)
                render (r.empty? ? {:nothing => true} : {:text => (r[:content] ?
                r[:content] : r.to_json)}), :layout => false
                end
                end

                #perconbaan: 2
                def el_finder(name = :elfinder, &block)
                self.send(:define_method, name) do
                h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)

                if r[:content]
                h.each_pair do |k,v|
                header k, v
                end
                render text: r[:content], layout: false
                else
                headers.merge!(h)
                render (r.empty? ? {:nothing => true} : {:text => r.to_json}),
                :layout => false
                end
                end
                end
                #perconbaan: 3
                # menunggu hasil dari laporan dari percobaan 1 dan 3 :D



                2012/10/11 Iqbal Farabi <farabi.iqbal@...>

                > I see. Dicoba dulu deh, karena memang yg alternatif ini belum saya coba
                > sama sekali. Thanks all. Nanti saya report lagi hasilnya gimana.
                >
                > 2012/10/11 Giovanni Sakti <giosakti@...>
                >
                > > **
                > >
                > >
                > > baru tune in nih..
                > > setuju pakai modifikasi response header..
                > >
                > > ada beberapa yang nulis, ini nemu barusan:
                > >
                > http://thedataasylum.com/articles/how-rails-nginx-x-accel-redirect-work-together.html
                > >
                > > jadi si gem el_finder ga perlu di modifikasi, controller cukup terima
                > path
                > > file yang mau di download dari si elfinder (sory ga familiar sama
                > > plugin/gemnya, tapi si elfinder harusnya bisa kirim path file yang mau di
                > > download ke rails lagi kan?)
                > >
                > > --
                > > Giovanni Sakti
                > > Starqle Indonesia
                > > http://www.starqle.com
                > >
                > >
                > > On Thursday, October 11, 2012 at 2:17 PM, tejanium wrote:
                > >
                > > >
                > > > Mungkin begini, jangan di require di lib/el_finder.rb tapi di include
                > di
                > > dalem kelas Connectornya di lib/el_finder/connector.rb
                > > >
                > > > jadi begini
                > > >
                > > > module ElFinder
                > > >
                > > > # Represents ElFinder connector on Rails side.
                > > > class Connector
                > > > include ActionController::DataStreaming
                > > >
                > > > ...
                > > >
                > > > end
                > > > end
                > > > itu jg kalo udah ke load ActionController-nya
                > > >
                > > > kalo gak mau ribed, cukup modifikasi header, sama header sama
                > contentnya
                > > aja seperti yang mas Nugroho bilang
                > > >
                > > > itu kan ada tuh di kelas Connector, @header sama @response, tambahin
                > aja
                > > disana
                > > >
                > > > CMIIW..
                > > >
                > > > ________________________________
                > > > From: Iqbal Farabi <farabi.iqbal@... (mailto:
                > > farabi.iqbal%40gmail.com)>
                > > > To: id-ruby@yahoogroups.com (mailto:id-ruby%40yahoogroups.com)
                > > > Sent: Thursday, October 11, 2012 1:59 PM
                > > > Subject: Re: [id-ruby] Re: Cara send_file di Ruby?
                > > >
                > > > Hmm.. jadi gini sih,
                > > >
                > > > Di file el_finer/connector.rb ada module ElFinder dan class Connector.
                > > > Ketika saya coba gunakan send_file dengan plain saja, pesan errornya
                > > adalah
                > > > NoMethodError for class ElFinder::Connector. Lalu saya ubek-ubek
                > sedikit
                > > > source code Rails, dan ketemu bahwa send_file ini adanya di
                > > > ActionController::DataStreaming (yg mana ini adalah sebuah module).
                > Nah,
                > > > pesan error itu terjadi karena saya coba panggil dengan cara seperti
                > ini
                > > > (sepertinya cara saya agak silly :D):
                > > >
                > > > 1. Di file utama el_finder.rb saya tambahkan
                > > > require 'action_controller/metal/data_streaming'
                > > >
                > > > 2. Pada file el_finder/connector.rb saya buat method baru untuk
                > download,
                > > > disitu saya pnggil send_file:
                > > > send_file('nama_file')
                > > >
                > > > 3. Pesan error:
                > > >
                > > > Started GET "/elfinder?cmd=download&target=bG9nb3MvZWxmaW5kZXIucG5n"
                > for
                > > > 127.0.0.1 at 2012-10-10 19:10:47 +0800
                > > > Processing by HomeController#elfinder as HTML
                > > > Parameters: {"cmd"=>"download", "target"=>"bG9nb3MvZWxmaW5kZXIucG5n"}
                > > > Completed 500 Internal Server Error in 2ms
                > > >
                > > > NoMethodError (undefined method `send_file' for
                > > > #<ElFinderQbl::Connector:0x00000003ce43e0>):
                > > > app/controllers/home_controller.rb:7:in `elfinder'
                > > >
                > > > 4. Sementara, source code dari Rails untuk send_file ada di sini
                > > >
                > >
                > https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/data_streaming.rb
                > > >
                > > > Terimakasih lho buat bantuan rekan-rekan semua. :)
                > > >
                > > > 2012/10/11 lyoneil_de_sire <lyoneil_de_sire@... (mailto:
                > > lyoneil_de_sire%40yahoo.com)>
                > >
                > > >
                > > > > **
                > > > >
                > > > >
                > > > > lho sebentar..
                > > > >
                > > > > errornya "NoMethodError for ActionController::DataStreaming:Module"?
                > > > >
                > > > > berarti si send_file nya sendiri mah ketemu yah.. karena dia tau kalo
                > > yg
                > > > > kita maksud tuh ada di ActionController::DataStreaming .. yg error
                > tuh
                > > > > ditempat lain.. bisa copy paste full error messages nya?
                > > > >
                > > > >
                > > > >
                > > >
                > > > --
                > > > Iqbal Farabi
                > > > CMO of Starqle Indonesia (iqbal@... (mailto:
                > iqbal%40starqle.com
                > > ))
                > >
                > > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                > > > farabi.iqbal@... (mailto:farabi.iqbal%40gmail.com)
                > >
                > > >
                > > > [Non-text portions of this message have been removed]
                > > >
                > > > ------------------------------------
                > > >
                > > > ID-Ruby
                > > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala
                > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
                > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                > > >
                > > > http://rubyurl.com/Q8DD
                > > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                > > >
                > > > [Non-text portions of this message have been removed]
                > > >
                > > >
                > >
                > > [Non-text portions of this message have been removed]
                > >
                > >
                > >
                >
                >
                >
                > --
                > Iqbal Farabi
                > CMO of Starqle Indonesia (iqbal@...)
                > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                > farabi.iqbal@...
                >
                >
                > [Non-text portions of this message have been removed]
                >
                >
                >
                > ------------------------------------
                >
                > ID-Ruby
                > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala
                > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
                > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                >
                > http://rubyurl.com/Q8DD
                > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                >
                >
                >
                >
                >


                --
                *"To accomplish great things, we must not only act, but also dream; not
                only plan, but also believe."* *~ Anatole France*


                [Non-text portions of this message have been removed]
              • Iqbal Farabi
                Mas Yacobus, thanks a lot. Saya sudah coba ikuti sarannya, ada sedikit modifikasi, meskipun masih gagal tapi ada sedikit kemajuan. Seperti ini: 1. Yg di
                Message 7 of 26 , Oct 12, 2012
                • 0 Attachment
                  Mas Yacobus, thanks a lot.

                  Saya sudah coba ikuti sarannya, ada sedikit modifikasi, meskipun masih
                  gagal tapi ada sedikit kemajuan. Seperti ini:

                  1. Yg di action.rb saya gunakan percobaan #1
                  2. Di connector.rb saya cuma ubah @response[:content].size
                  jadi @response[:content].size.to_s saja karena kalau tidak begitu selalu
                  raise NoMethodError 'split' for Fixnum. Yg mana setelah saya cek, yg
                  bertipe Fixnum ini ya si @response[:content].size. Lalu saya coba untuk
                  buka dari @target, tapi @target ternyata class lain dalam gem ini, nama
                  class-nya Pathname. Akhirnya saya coba yg standar dulu, saya buka aja file
                  sembarang pakai absolut path, code-nya jadi seperti ini:

                  def _download
                  @response[:content] = File.open('/home/iqbal/file_test.txt')
                  @headers['Content-Type'] = 'application/octet-stream'
                  @headers['Content-Disposition'] = 'attachment'
                  @headers['Content-Location'] = '/home/iqbal/file_test.txt'
                  @headers['Content-Transfer-Encoding'] = 'binary'
                  @headers['Content-Length'] = @response[:content].size.to_s
                  @headers['Connection'] = 'close'
                  else

                  Hasilnya, file ter-download, tapi begitu dibuka isinya cuma sebaris text
                  berikut:
                  #<File:0x007fb39412e928>

                  Nah, @response[:content] itu harusnya diisi apa ya? Apa saya udah bener
                  pake File.open untuk baris itu?

                  Thanks lagi sebelumnya.

                  Salam hangat,

                  2012/10/11 Yacobus Reinhart <yacobus.reinhart@...>

                  > **
                  >
                  >
                  > hmm,, jangan dilukai Nginx atau Webserver nya, dia gak salah apa2, coba
                  > metode ini:
                  > # sebelumnya hilangkan dulu require2 atau include2 yang di tambal sulam
                  > sebelumnya,
                  > # dan lebih baik kita bikin method serupa dengan send_file dan send_data
                  >
                  > # ini buat di connector.rb nya
                  > # Saya menganggap kalo @target adalah file
                  > def _download
                  > @response[:content] = @...
                  > @headers['Content-Type'] = 'application/octet-stream'
                  > @headers['Content-Disposition'] = 'attachment'
                  > @headers['Content-Location'] = @..._filename
                  > @headers['Content-Transfer-Encoding'] = 'binary'
                  > @headers['Content-Length'] = @response[:content].size
                  > @headers['Connection'] = 'close'
                  > end
                  >
                  > # Percobaan berikut untuk di action.rb nya.
                  > #percobaan: 1
                  > def el_finder(name = :elfinder, &block)
                  > self.send(:define_method, name) do
                  > h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)
                  > headers.merge!(h)
                  > render (r.empty? ? {:nothing => true} : {:text => (r[:content] ?
                  > r[:content] : r.to_json)}), :layout => false
                  > end
                  > end
                  >
                  > #perconbaan: 2
                  > def el_finder(name = :elfinder, &block)
                  > self.send(:define_method, name) do
                  > h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)
                  >
                  > if r[:content]
                  > h.each_pair do |k,v|
                  > header k, v
                  > end
                  > render text: r[:content], layout: false
                  > else
                  > headers.merge!(h)
                  > render (r.empty? ? {:nothing => true} : {:text => r.to_json}),
                  > :layout => false
                  > end
                  > end
                  > end
                  > #perconbaan: 3
                  > # menunggu hasil dari laporan dari percobaan 1 dan 3 :D
                  >
                  >
                  > 2012/10/11 Iqbal Farabi <farabi.iqbal@...>
                  >
                  > > I see. Dicoba dulu deh, karena memang yg alternatif ini belum saya coba
                  > > sama sekali. Thanks all. Nanti saya report lagi hasilnya gimana.
                  > >
                  > > 2012/10/11 Giovanni Sakti <giosakti@...>
                  > >
                  > > > **
                  >
                  > > >
                  > > >
                  > > > baru tune in nih..
                  > > > setuju pakai modifikasi response header..
                  > > >
                  > > > ada beberapa yang nulis, ini nemu barusan:
                  > > >
                  > >
                  > http://thedataasylum.com/articles/how-rails-nginx-x-accel-redirect-work-together.html
                  > > >
                  > > > jadi si gem el_finder ga perlu di modifikasi, controller cukup terima
                  > > path
                  > > > file yang mau di download dari si elfinder (sory ga familiar sama
                  > > > plugin/gemnya, tapi si elfinder harusnya bisa kirim path file yang mau
                  > di
                  > > > download ke rails lagi kan?)
                  > > >
                  > > > --
                  > > > Giovanni Sakti
                  > > > Starqle Indonesia
                  > > > http://www.starqle.com
                  > > >
                  > > >
                  > > > On Thursday, October 11, 2012 at 2:17 PM, tejanium wrote:
                  > > >
                  > > > >
                  > > > > Mungkin begini, jangan di require di lib/el_finder.rb tapi di include
                  > > di
                  > > > dalem kelas Connectornya di lib/el_finder/connector.rb
                  > > > >
                  > > > > jadi begini
                  > > > >
                  > > > > module ElFinder
                  > > > >
                  > > > > # Represents ElFinder connector on Rails side.
                  > > > > class Connector
                  > > > > include ActionController::DataStreaming
                  > > > >
                  > > > > ...
                  > > > >
                  > > > > end
                  > > > > end
                  > > > > itu jg kalo udah ke load ActionController-nya
                  > > > >
                  > > > > kalo gak mau ribed, cukup modifikasi header, sama header sama
                  > > contentnya
                  > > > aja seperti yang mas Nugroho bilang
                  > > > >
                  > > > > itu kan ada tuh di kelas Connector, @header sama @response, tambahin
                  > > aja
                  > > > disana
                  > > > >
                  > > > > CMIIW..
                  > > > >
                  > > > > ________________________________
                  > > > > From: Iqbal Farabi <farabi.iqbal@... (mailto:
                  > > > farabi.iqbal%40gmail.com)>
                  > > > > To: id-ruby@yahoogroups.com (mailto:id-ruby%40yahoogroups.com)
                  > > > > Sent: Thursday, October 11, 2012 1:59 PM
                  > > > > Subject: Re: [id-ruby] Re: Cara send_file di Ruby?
                  > > > >
                  > > > > Hmm.. jadi gini sih,
                  > > > >
                  > > > > Di file el_finer/connector.rb ada module ElFinder dan class
                  > Connector.
                  > > > > Ketika saya coba gunakan send_file dengan plain saja, pesan errornya
                  > > > adalah
                  > > > > NoMethodError for class ElFinder::Connector. Lalu saya ubek-ubek
                  > > sedikit
                  > > > > source code Rails, dan ketemu bahwa send_file ini adanya di
                  > > > > ActionController::DataStreaming (yg mana ini adalah sebuah module).
                  > > Nah,
                  > > > > pesan error itu terjadi karena saya coba panggil dengan cara seperti
                  > > ini
                  > > > > (sepertinya cara saya agak silly :D):
                  > > > >
                  > > > > 1. Di file utama el_finder.rb saya tambahkan
                  > > > > require 'action_controller/metal/data_streaming'
                  > > > >
                  > > > > 2. Pada file el_finder/connector.rb saya buat method baru untuk
                  > > download,
                  > > > > disitu saya pnggil send_file:
                  > > > > send_file('nama_file')
                  > > > >
                  > > > > 3. Pesan error:
                  > > > >
                  > > > > Started GET "/elfinder?cmd=download&target=bG9nb3MvZWxmaW5kZXIucG5n"
                  > > for
                  > > > > 127.0.0.1 at 2012-10-10 19:10:47 +0800
                  > > > > Processing by HomeController#elfinder as HTML
                  > > > > Parameters: {"cmd"=>"download", "target"=>"bG9nb3MvZWxmaW5kZXIucG5n"}
                  > > > > Completed 500 Internal Server Error in 2ms
                  > > > >
                  > > > > NoMethodError (undefined method `send_file' for
                  > > > > #<ElFinderQbl::Connector:0x00000003ce43e0>):
                  > > > > app/controllers/home_controller.rb:7:in `elfinder'
                  > > > >
                  > > > > 4. Sementara, source code dari Rails untuk send_file ada di sini
                  > > > >
                  > > >
                  > >
                  > https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/data_streaming.rb
                  > > > >
                  > > > > Terimakasih lho buat bantuan rekan-rekan semua. :)
                  > > > >
                  > > > > 2012/10/11 lyoneil_de_sire <lyoneil_de_sire@... (mailto:
                  > > > lyoneil_de_sire%40yahoo.com)>
                  > > >
                  > > > >
                  > > > > > **
                  > > > > >
                  > > > > >
                  > > > > > lho sebentar..
                  > > > > >
                  > > > > > errornya "NoMethodError for
                  > ActionController::DataStreaming:Module"?
                  > > > > >
                  > > > > > berarti si send_file nya sendiri mah ketemu yah.. karena dia tau
                  > kalo
                  > > > yg
                  > > > > > kita maksud tuh ada di ActionController::DataStreaming .. yg error
                  > > tuh
                  > > > > > ditempat lain.. bisa copy paste full error messages nya?
                  > > > > >
                  > > > > >
                  > > > > >
                  > > > >
                  > > > > --
                  > > > > Iqbal Farabi
                  > > > > CMO of Starqle Indonesia (iqbal@... (mailto:
                  > > iqbal%40starqle.com
                  > > > ))
                  > > >
                  > > > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                  > > > > farabi.iqbal@... (mailto:farabi.iqbal%40gmail.com)
                  > > >
                  > > > >
                  > > > > [Non-text portions of this message have been removed]
                  > > > >
                  > > > > ------------------------------------
                  > > > >
                  > > > > ID-Ruby
                  > > > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk
                  > segala
                  > > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
                  > > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                  > > > >
                  > > > > http://rubyurl.com/Q8DD
                  > > > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                  > > > >
                  > > > > [Non-text portions of this message have been removed]
                  > > > >
                  > > > >
                  > > >
                  > > > [Non-text portions of this message have been removed]
                  > > >
                  > > >
                  > > >
                  > >
                  > >
                  > >
                  > > --
                  > > Iqbal Farabi
                  > > CMO of Starqle Indonesia (iqbal@...)
                  > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                  > > farabi.iqbal@...
                  > >
                  > >
                  > > [Non-text portions of this message have been removed]
                  > >
                  > >
                  > >
                  > > ------------------------------------
                  > >
                  > > ID-Ruby
                  > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala
                  > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
                  > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                  > >
                  > > http://rubyurl.com/Q8DD
                  > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                  > >
                  > >
                  > >
                  > >
                  > >
                  >
                  > --
                  > *"To accomplish great things, we must not only act, but also dream; not
                  > only plan, but also believe."* *~ Anatole France*
                  >
                  >
                  > [Non-text portions of this message have been removed]
                  >
                  >
                  >



                  --
                  Iqbal Farabi
                  CMO of Starqle Indonesia (iqbal@...)
                  Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                  farabi.iqbal@...


                  [Non-text portions of this message have been removed]
                • Giovanni Sakti
                  coba pakai render text render :text = File.open(file) -- Giovanni Sakti Starqle Indonesia http://www.starqle.com ... [Non-text portions of this message have
                  Message 8 of 26 , Oct 12, 2012
                  • 0 Attachment
                    coba pakai render text
                    render :text => File.open(file)

                    --
                    Giovanni Sakti
                    Starqle Indonesia
                    http://www.starqle.com


                    On Friday, October 12, 2012 at 2:01 PM, Iqbal Farabi wrote:

                    > Mas Yacobus, thanks a lot.
                    >
                    > Saya sudah coba ikuti sarannya, ada sedikit modifikasi, meskipun masih
                    > gagal tapi ada sedikit kemajuan. Seperti ini:
                    >
                    > 1. Yg di action.rb saya gunakan percobaan #1
                    > 2. Di connector.rb saya cuma ubah @response[:content].size
                    > jadi @response[:content].size.to_s saja karena kalau tidak begitu selalu
                    > raise NoMethodError 'split' for Fixnum. Yg mana setelah saya cek, yg
                    > bertipe Fixnum ini ya si @response[:content].size. Lalu saya coba untuk
                    > buka dari @target, tapi @target ternyata class lain dalam gem ini, nama
                    > class-nya Pathname. Akhirnya saya coba yg standar dulu, saya buka aja file
                    > sembarang pakai absolut path, code-nya jadi seperti ini:
                    >
                    > def _download
                    > @response[:content] = File.open('/home/iqbal/file_test.txt')
                    > @headers['Content-Type'] = 'application/octet-stream'
                    > @headers['Content-Disposition'] = 'attachment'
                    > @headers['Content-Location'] = '/home/iqbal/file_test.txt'
                    > @headers['Content-Transfer-Encoding'] = 'binary'
                    > @headers['Content-Length'] = @response[:content].size.to_s
                    > @headers['Connection'] = 'close'
                    > else
                    >
                    > Hasilnya, file ter-download, tapi begitu dibuka isinya cuma sebaris text
                    > berikut:
                    > #<File:0x007fb39412e928>
                    >
                    > Nah, @response[:content] itu harusnya diisi apa ya? Apa saya udah bener
                    > pake File.open untuk baris itu?
                    >
                    > Thanks lagi sebelumnya.
                    >
                    > Salam hangat,
                    >
                    > 2012/10/11 Yacobus Reinhart <yacobus.reinhart@... (mailto:yacobus.reinhart@...)>
                    >
                    > > **
                    > >
                    > >
                    > > hmm,, jangan dilukai Nginx atau Webserver nya, dia gak salah apa2, coba
                    > > metode ini:
                    > > # sebelumnya hilangkan dulu require2 atau include2 yang di tambal sulam
                    > > sebelumnya,
                    > > # dan lebih baik kita bikin method serupa dengan send_file dan send_data
                    > >
                    > > # ini buat di connector.rb nya
                    > > # Saya menganggap kalo @target adalah file
                    > > def _download
                    > > @response[:content] = @...
                    > > @headers['Content-Type'] = 'application/octet-stream'
                    > > @headers['Content-Disposition'] = 'attachment'
                    > > @headers['Content-Location'] = @..._filename
                    > > @headers['Content-Transfer-Encoding'] = 'binary'
                    > > @headers['Content-Length'] = @response[:content].size
                    > > @headers['Connection'] = 'close'
                    > > end
                    > >
                    > > # Percobaan berikut untuk di action.rb nya.
                    > > #percobaan: 1
                    > > def el_finder(name = :elfinder, &block)
                    > > self.send(:define_method, name) do
                    > > h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)
                    > > headers.merge!(h)
                    > > render (r.empty? ? {:nothing => true} : {:text => (r[:content] ?
                    > > r[:content] : r.to_json)}), :layout => false
                    > > end
                    > > end
                    > >
                    > > #perconbaan: 2
                    > > def el_finder(name = :elfinder, &block)
                    > > self.send(:define_method, name) do
                    > > h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)
                    > >
                    > > if r[:content]
                    > > h.each_pair do |k,v|
                    > > header k, v
                    > > end
                    > > render text: r[:content], layout: false
                    > > else
                    > > headers.merge!(h)
                    > > render (r.empty? ? {:nothing => true} : {:text => r.to_json}),
                    > > :layout => false
                    > > end
                    > > end
                    > > end
                    > > #perconbaan: 3
                    > > # menunggu hasil dari laporan dari percobaan 1 dan 3 :D
                    > >
                    > >
                    > > 2012/10/11 Iqbal Farabi <farabi.iqbal@... (mailto:farabi.iqbal@...)>
                    > >
                    > > > I see. Dicoba dulu deh, karena memang yg alternatif ini belum saya coba
                    > > > sama sekali. Thanks all. Nanti saya report lagi hasilnya gimana.
                    > > >
                    > > > 2012/10/11 Giovanni Sakti <giosakti@... (mailto:giosakti@...)>
                    > > >
                    > > > > **
                    > >
                    > > > >
                    > > > >
                    > > > > baru tune in nih..
                    > > > > setuju pakai modifikasi response header..
                    > > > >
                    > > > > ada beberapa yang nulis, ini nemu barusan:
                    > > http://thedataasylum.com/articles/how-rails-nginx-x-accel-redirect-work-together.html
                    > > > >
                    > > > > jadi si gem el_finder ga perlu di modifikasi, controller cukup terima
                    > > > path
                    > > > > file yang mau di download dari si elfinder (sory ga familiar sama
                    > > > > plugin/gemnya, tapi si elfinder harusnya bisa kirim path file yang mau
                    > > > >
                    > > >
                    > > >
                    > >
                    > > di
                    > > > > download ke rails lagi kan?)
                    > > > >
                    > > > > --
                    > > > > Giovanni Sakti
                    > > > > Starqle Indonesia
                    > > > > http://www.starqle.com
                    > > > >
                    > > > >
                    > > > > On Thursday, October 11, 2012 at 2:17 PM, tejanium wrote:
                    > > > >
                    > > > > >
                    > > > > > Mungkin begini, jangan di require di lib/el_finder.rb tapi di include
                    > > > di
                    > > > > dalem kelas Connectornya di lib/el_finder/connector.rb
                    > > > > >
                    > > > > > jadi begini
                    > > > > >
                    > > > > > module ElFinder
                    > > > > >
                    > > > > > # Represents ElFinder connector on Rails side.
                    > > > > > class Connector
                    > > > > > include ActionController::DataStreaming
                    > > > > >
                    > > > > > ...
                    > > > > >
                    > > > > > end
                    > > > > > end
                    > > > > > itu jg kalo udah ke load ActionController-nya
                    > > > > >
                    > > > > > kalo gak mau ribed, cukup modifikasi header, sama header sama
                    > > > contentnya
                    > > > > aja seperti yang mas Nugroho bilang
                    > > > > >
                    > > > > > itu kan ada tuh di kelas Connector, @header sama @response, tambahin
                    > > > aja
                    > > > > disana
                    > > > > >
                    > > > > > CMIIW..
                    > > > > >
                    > > > > > ________________________________
                    > > > > > From: Iqbal Farabi <farabi.iqbal@... (mailto:farabi.iqbal@...) (mailto:
                    > > > > >
                    > > > >
                    > > > > farabi.iqbal%40gmail.com (http://40gmail.com))>
                    > > > > > To: id-ruby@yahoogroups.com (mailto:id-ruby%40yahoogroups.com (http://40yahoogroups.com))
                    > > > > > Sent: Thursday, October 11, 2012 1:59 PM
                    > > > > > Subject: Re: [id-ruby] Re: Cara send_file di Ruby?
                    > > > > >
                    > > > > > Hmm.. jadi gini sih,
                    > > > > >
                    > > > > > Di file el_finer/connector.rb ada module ElFinder dan class
                    > > Connector.
                    > > > > > Ketika saya coba gunakan send_file dengan plain saja, pesan errornya
                    > > > >
                    > > > > adalah
                    > > > > > NoMethodError for class ElFinder::Connector. Lalu saya ubek-ubek
                    > > > >
                    > > > >
                    > > >
                    > > > sedikit
                    > > > > > source code Rails, dan ketemu bahwa send_file ini adanya di
                    > > > > > ActionController::DataStreaming (yg mana ini adalah sebuah module).
                    > > > > >
                    > > > >
                    > > >
                    > > > Nah,
                    > > > > > pesan error itu terjadi karena saya coba panggil dengan cara seperti
                    > > > >
                    > > >
                    > > > ini
                    > > > > > (sepertinya cara saya agak silly :D):
                    > > > > >
                    > > > > > 1. Di file utama el_finder.rb saya tambahkan
                    > > > > > require 'action_controller/metal/data_streaming'
                    > > > > >
                    > > > > > 2. Pada file el_finder/connector.rb saya buat method baru untuk
                    > > > download,
                    > > > > > disitu saya pnggil send_file:
                    > > > > > send_file('nama_file')
                    > > > > >
                    > > > > > 3. Pesan error:
                    > > > > >
                    > > > > > Started GET "/elfinder?cmd=download&target=bG9nb3MvZWxmaW5kZXIucG5n"
                    > > > for
                    > > > > > 127.0.0.1 at 2012-10-10 19:10:47 +0800
                    > > > > > Processing by HomeController#elfinder as HTML
                    > > > > > Parameters: {"cmd"=>"download", "target"=>"bG9nb3MvZWxmaW5kZXIucG5n"}
                    > > > > > Completed 500 Internal Server Error in 2ms
                    > > > > >
                    > > > > > NoMethodError (undefined method `send_file' for
                    > > > > > #<ElFinderQbl::Connector:0x00000003ce43e0>):
                    > > > > > app/controllers/home_controller.rb:7:in `elfinder'
                    > > > > >
                    > > > > > 4. Sementara, source code dari Rails untuk send_file ada di sini
                    > > https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/data_streaming.rb
                    > > > > >
                    > > > > > Terimakasih lho buat bantuan rekan-rekan semua. :)
                    > > > > >
                    > > > > > 2012/10/11 lyoneil_de_sire <lyoneil_de_sire@... (mailto:lyoneil_de_sire@...) (mailto:
                    > > > > lyoneil_de_sire%40yahoo.com (http://40yahoo.com))>
                    > > > >
                    > > > > >
                    > > > > > > **
                    > > > > > >
                    > > > > > >
                    > > > > > > lho sebentar..
                    > > > > > >
                    > > > > > > errornya "NoMethodError for
                    > > ActionController::DataStreaming:Module"?
                    > > > > > >
                    > > > > > > berarti si send_file nya sendiri mah ketemu yah.. karena dia tau
                    > > kalo
                    > > > > yg
                    > > > > > > kita maksud tuh ada di ActionController::DataStreaming .. yg error
                    > > > > >
                    > > > >
                    > > > >
                    > > >
                    > > > tuh
                    > > > > > > ditempat lain.. bisa copy paste full error messages nya?
                    > > > > >
                    > > > > >
                    > > > > > --
                    > > > > > Iqbal Farabi
                    > > > > > CMO of Starqle Indonesia (iqbal@... (mailto:iqbal@...) (mailto:
                    > > > > >
                    > > > >
                    > > >
                    > > > iqbal%40starqle.com (http://40starqle.com)
                    > > > > ))
                    > > > >
                    > > > > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                    > > > > > farabi.iqbal@... (mailto:farabi.iqbal%40gmail.com (http://40gmail.com))
                    > > > > >
                    > > > >
                    > > > >
                    > > > > >
                    > > > > > [Non-text portions of this message have been removed]
                    > > > > >
                    > > > > > ------------------------------------
                    > > > > >
                    > > > > > ID-Ruby
                    > > > > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk
                    > > > > >
                    > > > >
                    > > > >
                    > > >
                    > > >
                    > >
                    > > segala
                    > > > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
                    > > > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                    > > > > >
                    > > > > > http://rubyurl.com/Q8DD
                    > > > > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                    > > > > >
                    > > > > > [Non-text portions of this message have been removed]
                    > > > >
                    > > > > [Non-text portions of this message have been removed]
                    > > >
                    > > >
                    > > >
                    > > > --
                    > > > Iqbal Farabi
                    > > > CMO of Starqle Indonesia (iqbal@... (mailto:iqbal@...))
                    > > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                    > > > farabi.iqbal@... (mailto:farabi.iqbal@...)
                    > > >
                    > > >
                    > > > [Non-text portions of this message have been removed]
                    > > >
                    > > >
                    > > >
                    > > > ------------------------------------
                    > > >
                    > > > ID-Ruby
                    > > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala
                    > > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
                    > > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                    > > >
                    > > > http://rubyurl.com/Q8DD
                    > > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                    > > >
                    > >
                    > >
                    > > --
                    > > *"To accomplish great things, we must not only act, but also dream; not
                    > > only plan, but also believe."* *~ Anatole France*
                    > >
                    > >
                    > > [Non-text portions of this message have been removed]
                    > >
                    >
                    >
                    >
                    > --
                    > Iqbal Farabi
                    > CMO of Starqle Indonesia (iqbal@... (mailto:iqbal@...))
                    > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                    > farabi.iqbal@... (mailto:farabi.iqbal@...)
                    >
                    >
                    > [Non-text portions of this message have been removed]
                    >
                    >
                    >
                    > ------------------------------------
                    >
                    > ID-Ruby
                    > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                    >
                    > http://rubyurl.com/Q8DD
                    > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                    >
                    >
                    >
                    >
                    >




                    [Non-text portions of this message have been removed]
                  • Iqbal Farabi
                    Hmm.. karena udah di dalem class Connector (di dalem modulnya gitu), manggil langsung render gitu raise error: NoMethodError (undefined method `render for
                    Message 9 of 26 , Oct 12, 2012
                    • 0 Attachment
                      Hmm.. karena udah di dalem class Connector (di dalem modulnya gitu),
                      manggil langsung render gitu raise error:
                      NoMethodError (undefined method `render' for
                      #<ElFinder::Connector:0x00000003edb770>)

                      Kalo masih di luar kelas, kaya di action.rb bisa. Tapi masalahnya, di gem
                      ini udah begitu modelnya, aksi-aksi lain semua di-handle sama class
                      Connector ini.

                      2012/10/12 Giovanni Sakti <giosakti@...>

                      > **
                      >
                      >
                      > coba pakai render text
                      > render :text => File.open(file)
                      >
                      >
                      > --
                      > Giovanni Sakti
                      > Starqle Indonesia
                      > http://www.starqle.com
                      >
                      > On Friday, October 12, 2012 at 2:01 PM, Iqbal Farabi wrote:
                      >
                      > > Mas Yacobus, thanks a lot.
                      > >
                      > > Saya sudah coba ikuti sarannya, ada sedikit modifikasi, meskipun masih
                      > > gagal tapi ada sedikit kemajuan. Seperti ini:
                      > >
                      > > 1. Yg di action.rb saya gunakan percobaan #1
                      > > 2. Di connector.rb saya cuma ubah @response[:content].size
                      > > jadi @response[:content].size.to_s saja karena kalau tidak begitu selalu
                      > > raise NoMethodError 'split' for Fixnum. Yg mana setelah saya cek, yg
                      > > bertipe Fixnum ini ya si @response[:content].size. Lalu saya coba untuk
                      > > buka dari @target, tapi @target ternyata class lain dalam gem ini, nama
                      > > class-nya Pathname. Akhirnya saya coba yg standar dulu, saya buka aja
                      > file
                      > > sembarang pakai absolut path, code-nya jadi seperti ini:
                      > >
                      > > def _download
                      > > @response[:content] = File.open('/home/iqbal/file_test.txt')
                      > > @headers['Content-Type'] = 'application/octet-stream'
                      > > @headers['Content-Disposition'] = 'attachment'
                      > > @headers['Content-Location'] = '/home/iqbal/file_test.txt'
                      > > @headers['Content-Transfer-Encoding'] = 'binary'
                      > > @headers['Content-Length'] = @response[:content].size.to_s
                      > > @headers['Connection'] = 'close'
                      > > else
                      > >
                      > > Hasilnya, file ter-download, tapi begitu dibuka isinya cuma sebaris text
                      > > berikut:
                      > > #<File:0x007fb39412e928>
                      > >
                      > > Nah, @response[:content] itu harusnya diisi apa ya? Apa saya udah bener
                      > > pake File.open untuk baris itu?
                      > >
                      > > Thanks lagi sebelumnya.
                      > >
                      > > Salam hangat,
                      > >
                      > > 2012/10/11 Yacobus Reinhart <yacobus.reinhart@... (mailto:
                      > yacobus.reinhart@...)>
                      > >
                      > > > **
                      >
                      > > >
                      > > >
                      > > > hmm,, jangan dilukai Nginx atau Webserver nya, dia gak salah apa2, coba
                      > > > metode ini:
                      > > > # sebelumnya hilangkan dulu require2 atau include2 yang di tambal sulam
                      > > > sebelumnya,
                      > > > # dan lebih baik kita bikin method serupa dengan send_file dan
                      > send_data
                      > > >
                      > > > # ini buat di connector.rb nya
                      > > > # Saya menganggap kalo @target adalah file
                      > > > def _download
                      > > > @response[:content] = @...
                      > > > @headers['Content-Type'] = 'application/octet-stream'
                      > > > @headers['Content-Disposition'] = 'attachment'
                      > > > @headers['Content-Location'] = @..._filename
                      > > > @headers['Content-Transfer-Encoding'] = 'binary'
                      > > > @headers['Content-Length'] = @response[:content].size
                      > > > @headers['Connection'] = 'close'
                      > > > end
                      > > >
                      > > > # Percobaan berikut untuk di action.rb nya.
                      > > > #percobaan: 1
                      > > > def el_finder(name = :elfinder, &block)
                      > > > self.send(:define_method, name) do
                      > > > h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)
                      > > > headers.merge!(h)
                      > > > render (r.empty? ? {:nothing => true} : {:text => (r[:content] ?
                      > > > r[:content] : r.to_json)}), :layout => false
                      > > > end
                      > > > end
                      > > >
                      > > > #perconbaan: 2
                      > > > def el_finder(name = :elfinder, &block)
                      > > > self.send(:define_method, name) do
                      > > > h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)
                      > > >
                      > > > if r[:content]
                      > > > h.each_pair do |k,v|
                      > > > header k, v
                      > > > end
                      > > > render text: r[:content], layout: false
                      > > > else
                      > > > headers.merge!(h)
                      > > > render (r.empty? ? {:nothing => true} : {:text => r.to_json}),
                      > > > :layout => false
                      > > > end
                      > > > end
                      > > > end
                      > > > #perconbaan: 3
                      > > > # menunggu hasil dari laporan dari percobaan 1 dan 3 :D
                      > > >
                      > > >
                      > > > 2012/10/11 Iqbal Farabi <farabi.iqbal@... (mailto:
                      > farabi.iqbal@...)>
                      >
                      > > >
                      > > > > I see. Dicoba dulu deh, karena memang yg alternatif ini belum saya
                      > coba
                      > > > > sama sekali. Thanks all. Nanti saya report lagi hasilnya gimana.
                      > > > >
                      > > > > 2012/10/11 Giovanni Sakti <giosakti@... (mailto:
                      > giosakti@...)>
                      >
                      > > > >
                      > > > > > **
                      > > >
                      > > > > >
                      > > > > >
                      > > > > > baru tune in nih..
                      > > > > > setuju pakai modifikasi response header..
                      > > > > >
                      > > > > > ada beberapa yang nulis, ini nemu barusan:
                      > > >
                      > http://thedataasylum.com/articles/how-rails-nginx-x-accel-redirect-work-together.html
                      > > > > >
                      > > > > > jadi si gem el_finder ga perlu di modifikasi, controller cukup
                      > terima
                      > > > > path
                      > > > > > file yang mau di download dari si elfinder (sory ga familiar sama
                      > > > > > plugin/gemnya, tapi si elfinder harusnya bisa kirim path file yang
                      > mau
                      > > > > >
                      > > > >
                      > > > >
                      > > >
                      > > > di
                      > > > > > download ke rails lagi kan?)
                      > > > > >
                      > > > > > --
                      > > > > > Giovanni Sakti
                      > > > > > Starqle Indonesia
                      > > > > > http://www.starqle.com
                      > > > > >
                      > > > > >
                      > > > > > On Thursday, October 11, 2012 at 2:17 PM, tejanium wrote:
                      > > > > >
                      > > > > > >
                      > > > > > > Mungkin begini, jangan di require di lib/el_finder.rb tapi di
                      > include
                      > > > > di
                      > > > > > dalem kelas Connectornya di lib/el_finder/connector.rb
                      > > > > > >
                      > > > > > > jadi begini
                      > > > > > >
                      > > > > > > module ElFinder
                      > > > > > >
                      > > > > > > # Represents ElFinder connector on Rails side.
                      > > > > > > class Connector
                      > > > > > > include ActionController::DataStreaming
                      > > > > > >
                      > > > > > > ...
                      > > > > > >
                      > > > > > > end
                      > > > > > > end
                      > > > > > > itu jg kalo udah ke load ActionController-nya
                      > > > > > >
                      > > > > > > kalo gak mau ribed, cukup modifikasi header, sama header sama
                      > > > > contentnya
                      > > > > > aja seperti yang mas Nugroho bilang
                      > > > > > >
                      > > > > > > itu kan ada tuh di kelas Connector, @header sama @response,
                      > tambahin
                      > > > > aja
                      > > > > > disana
                      > > > > > >
                      > > > > > > CMIIW..
                      > > > > > >
                      > > > > > > ________________________________
                      > > > > > > From: Iqbal Farabi <farabi.iqbal@... (mailto:
                      > farabi.iqbal@...) (mailto:
                      > > > > > >
                      > > > > >
                      > > > > > farabi.iqbal%40gmail.com (http://40gmail.com))>
                      > > > > > > To: id-ruby@yahoogroups.com (mailto:id-ruby%40yahoogroups.com (
                      > http://40yahoogroups.com))
                      >
                      > > > > > > Sent: Thursday, October 11, 2012 1:59 PM
                      > > > > > > Subject: Re: [id-ruby] Re: Cara send_file di Ruby?
                      > > > > > >
                      > > > > > > Hmm.. jadi gini sih,
                      > > > > > >
                      > > > > > > Di file el_finer/connector.rb ada module ElFinder dan class
                      > > > Connector.
                      > > > > > > Ketika saya coba gunakan send_file dengan plain saja, pesan
                      > errornya
                      > > > > >
                      > > > > > adalah
                      > > > > > > NoMethodError for class ElFinder::Connector. Lalu saya ubek-ubek
                      > > > > >
                      > > > > >
                      > > > >
                      > > > > sedikit
                      > > > > > > source code Rails, dan ketemu bahwa send_file ini adanya di
                      > > > > > > ActionController::DataStreaming (yg mana ini adalah sebuah
                      > module).
                      > > > > > >
                      > > > > >
                      > > > >
                      > > > > Nah,
                      > > > > > > pesan error itu terjadi karena saya coba panggil dengan cara
                      > seperti
                      > > > > >
                      > > > >
                      > > > > ini
                      > > > > > > (sepertinya cara saya agak silly :D):
                      > > > > > >
                      > > > > > > 1. Di file utama el_finder.rb saya tambahkan
                      > > > > > > require 'action_controller/metal/data_streaming'
                      > > > > > >
                      > > > > > > 2. Pada file el_finder/connector.rb saya buat method baru untuk
                      > > > > download,
                      > > > > > > disitu saya pnggil send_file:
                      > > > > > > send_file('nama_file')
                      > > > > > >
                      > > > > > > 3. Pesan error:
                      > > > > > >
                      > > > > > > Started GET
                      > "/elfinder?cmd=download&target=bG9nb3MvZWxmaW5kZXIucG5n"
                      > > > > for
                      > > > > > > 127.0.0.1 at 2012-10-10 19:10:47 +0800
                      > > > > > > Processing by HomeController#elfinder as HTML
                      > > > > > > Parameters: {"cmd"=>"download",
                      > "target"=>"bG9nb3MvZWxmaW5kZXIucG5n"}
                      > > > > > > Completed 500 Internal Server Error in 2ms
                      > > > > > >
                      > > > > > > NoMethodError (undefined method `send_file' for
                      > > > > > > #<ElFinderQbl::Connector:0x00000003ce43e0>):
                      > > > > > > app/controllers/home_controller.rb:7:in `elfinder'
                      > > > > > >
                      > > > > > > 4. Sementara, source code dari Rails untuk send_file ada di sini
                      > > >
                      > https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/data_streaming.rb
                      > > > > > >
                      > > > > > > Terimakasih lho buat bantuan rekan-rekan semua. :)
                      > > > > > >
                      > > > > > > 2012/10/11 lyoneil_de_sire <lyoneil_de_sire@... (mailto:
                      > lyoneil_de_sire@...) (mailto:
                      > > > > > lyoneil_de_sire%40yahoo.com (http://40yahoo.com))>
                      >
                      > > > > >
                      > > > > > >
                      > > > > > > > **
                      > > > > > > >
                      > > > > > > >
                      > > > > > > > lho sebentar..
                      > > > > > > >
                      > > > > > > > errornya "NoMethodError for
                      > > > ActionController::DataStreaming:Module"?
                      > > > > > > >
                      > > > > > > > berarti si send_file nya sendiri mah ketemu yah.. karena dia
                      > tau
                      > > > kalo
                      > > > > > yg
                      > > > > > > > kita maksud tuh ada di ActionController::DataStreaming .. yg
                      > error
                      > > > > > >
                      > > > > >
                      > > > > >
                      > > > >
                      > > > > tuh
                      > > > > > > > ditempat lain.. bisa copy paste full error messages nya?
                      > > > > > >
                      > > > > > >
                      > > > > > > --
                      > > > > > > Iqbal Farabi
                      > > > > > > CMO of Starqle Indonesia (iqbal@... (mailto:
                      > iqbal@...) (mailto:
                      > > > > > >
                      > > > > >
                      > > > >
                      > > > > iqbal%40starqle.com (http://40starqle.com)
                      >
                      > > > > > ))
                      > > > > >
                      > > > > > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/
                      > )
                      > > > > > > farabi.iqbal@... (mailto:farabi.iqbal%40gmail.com (
                      > http://40gmail.com))
                      >
                      > > > > > >
                      > > > > >
                      > > > > >
                      > > > > > >
                      > > > > > > [Non-text portions of this message have been removed]
                      > > > > > >
                      > > > > > > ------------------------------------
                      > > > > > >
                      > > > > > > ID-Ruby
                      > > > > > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk
                      > > > > > >
                      > > > > >
                      > > > > >
                      > > > >
                      > > > >
                      > > >
                      > > > segala
                      > > > > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang
                      > dibuat
                      > > > > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                      > > > > > >
                      > > > > > > http://rubyurl.com/Q8DD
                      > > > > > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                      > > > > > >
                      > > > > > > [Non-text portions of this message have been removed]
                      > > > > >
                      > > > > > [Non-text portions of this message have been removed]
                      > > > >
                      > > > >
                      > > > >
                      > > > > --
                      > > > > Iqbal Farabi
                      > > > > CMO of Starqle Indonesia (iqbal@... (mailto:
                      > iqbal@...))
                      >
                      > > > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                      > > > > farabi.iqbal@... (mailto:farabi.iqbal@...)
                      >
                      > > > >
                      > > > >
                      > > > > [Non-text portions of this message have been removed]
                      > > > >
                      > > > >
                      > > > >
                      > > > > ------------------------------------
                      > > > >
                      > > > > ID-Ruby
                      > > > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk
                      > segala
                      > > > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang
                      > dibuat
                      > > > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                      > > > >
                      > > > > http://rubyurl.com/Q8DD
                      > > > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                      > > > >
                      > > >
                      > > >
                      > > > --
                      > > > *"To accomplish great things, we must not only act, but also dream; not
                      > > > only plan, but also believe."* *~ Anatole France*
                      > > >
                      > > >
                      > > > [Non-text portions of this message have been removed]
                      > > >
                      > >
                      > >
                      > >
                      > > --
                      > > Iqbal Farabi
                      > > CMO of Starqle Indonesia (iqbal@... (mailto:iqbal@...))
                      >
                      > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                      > > farabi.iqbal@... (mailto:farabi.iqbal@...)
                      >
                      > >
                      > >
                      > > [Non-text portions of this message have been removed]
                      > >
                      > >
                      > >
                      > > ------------------------------------
                      > >
                      > > ID-Ruby
                      > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala
                      > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
                      > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                      > >
                      > > http://rubyurl.com/Q8DD
                      > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                      > >
                      > >
                      > >
                      > >
                      > >
                      >
                      > [Non-text portions of this message have been removed]
                      >
                      >
                      >



                      --
                      Iqbal Farabi
                      CMO of Starqle Indonesia (iqbal@...)
                      Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                      farabi.iqbal@...


                      [Non-text portions of this message have been removed]
                    • Giovanni Sakti
                      Coba file = File.open(file, rb ) @response[:content] = file.read -- Giovanni Sakti Starqle Indonesia http://www.starqle.com ... [Non-text portions of this
                      Message 10 of 26 , Oct 12, 2012
                      • 0 Attachment
                        Coba

                        file = File.open(file, "rb")
                        @response[:content] = file.read

                        --
                        Giovanni Sakti
                        Starqle Indonesia
                        http://www.starqle.com


                        On Friday, October 12, 2012 at 2:13 PM, Iqbal Farabi wrote:

                        > Hmm.. karena udah di dalem class Connector (di dalem modulnya gitu),
                        > manggil langsung render gitu raise error:
                        > NoMethodError (undefined method `render' for
                        > #<ElFinder::Connector:0x00000003edb770>)
                        >
                        > Kalo masih di luar kelas, kaya di action.rb bisa. Tapi masalahnya, di gem
                        > ini udah begitu modelnya, aksi-aksi lain semua di-handle sama class
                        > Connector ini.
                        >
                        > 2012/10/12 Giovanni Sakti <giosakti@... (mailto:giosakti@...)>
                        >
                        > > **
                        > >
                        > >
                        > > coba pakai render text
                        > > render :text => File.open(file)
                        > >
                        > >
                        > > --
                        > > Giovanni Sakti
                        > > Starqle Indonesia
                        > > http://www.starqle.com
                        > >
                        > > On Friday, October 12, 2012 at 2:01 PM, Iqbal Farabi wrote:
                        > >
                        > > > Mas Yacobus, thanks a lot.
                        > > >
                        > > > Saya sudah coba ikuti sarannya, ada sedikit modifikasi, meskipun masih
                        > > > gagal tapi ada sedikit kemajuan. Seperti ini:
                        > > >
                        > > > 1. Yg di action.rb saya gunakan percobaan #1
                        > > > 2. Di connector.rb saya cuma ubah @response[:content].size
                        > > > jadi @response[:content].size.to_s saja karena kalau tidak begitu selalu
                        > > > raise NoMethodError 'split' for Fixnum. Yg mana setelah saya cek, yg
                        > > > bertipe Fixnum ini ya si @response[:content].size. Lalu saya coba untuk
                        > > > buka dari @target, tapi @target ternyata class lain dalam gem ini, nama
                        > > > class-nya Pathname. Akhirnya saya coba yg standar dulu, saya buka aja
                        > > >
                        > >
                        > > file
                        > > > sembarang pakai absolut path, code-nya jadi seperti ini:
                        > > >
                        > > > def _download
                        > > > @response[:content] = File.open('/home/iqbal/file_test.txt')
                        > > > @headers['Content-Type'] = 'application/octet-stream'
                        > > > @headers['Content-Disposition'] = 'attachment'
                        > > > @headers['Content-Location'] = '/home/iqbal/file_test.txt'
                        > > > @headers['Content-Transfer-Encoding'] = 'binary'
                        > > > @headers['Content-Length'] = @response[:content].size.to_s
                        > > > @headers['Connection'] = 'close'
                        > > > else
                        > > >
                        > > > Hasilnya, file ter-download, tapi begitu dibuka isinya cuma sebaris text
                        > > > berikut:
                        > > > #<File:0x007fb39412e928>
                        > > >
                        > > > Nah, @response[:content] itu harusnya diisi apa ya? Apa saya udah bener
                        > > > pake File.open untuk baris itu?
                        > > >
                        > > > Thanks lagi sebelumnya.
                        > > >
                        > > > Salam hangat,
                        > > >
                        > > > 2012/10/11 Yacobus Reinhart <yacobus.reinhart@... (mailto:yacobus.reinhart@...) (mailto:
                        > > yacobus.reinhart@... (mailto:yacobus.reinhart@...))>
                        > > >
                        > > > > **
                        > >
                        > > > >
                        > > > >
                        > > > > hmm,, jangan dilukai Nginx atau Webserver nya, dia gak salah apa2, coba
                        > > > > metode ini:
                        > > > > # sebelumnya hilangkan dulu require2 atau include2 yang di tambal sulam
                        > > > > sebelumnya,
                        > > > > # dan lebih baik kita bikin method serupa dengan send_file dan
                        > > > >
                        > > >
                        > >
                        > > send_data
                        > > > >
                        > > > > # ini buat di connector.rb nya
                        > > > > # Saya menganggap kalo @target adalah file
                        > > > > def _download
                        > > > > @response[:content] = @...
                        > > > > @headers['Content-Type'] = 'application/octet-stream'
                        > > > > @headers['Content-Disposition'] = 'attachment'
                        > > > > @headers['Content-Location'] = @..._filename
                        > > > > @headers['Content-Transfer-Encoding'] = 'binary'
                        > > > > @headers['Content-Length'] = @response[:content].size
                        > > > > @headers['Connection'] = 'close'
                        > > > > end
                        > > > >
                        > > > > # Percobaan berikut untuk di action.rb nya.
                        > > > > #percobaan: 1
                        > > > > def el_finder(name = :elfinder, &block)
                        > > > > self.send(:define_method, name) do
                        > > > > h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)
                        > > > > headers.merge!(h)
                        > > > > render (r.empty? ? {:nothing => true} : {:text => (r[:content] ?
                        > > > > r[:content] : r.to_json)}), :layout => false
                        > > > > end
                        > > > > end
                        > > > >
                        > > > > #perconbaan: 2
                        > > > > def el_finder(name = :elfinder, &block)
                        > > > > self.send(:define_method, name) do
                        > > > > h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)
                        > > > >
                        > > > > if r[:content]
                        > > > > h.each_pair do |k,v|
                        > > > > header k, v
                        > > > > end
                        > > > > render text: r[:content], layout: false
                        > > > > else
                        > > > > headers.merge!(h)
                        > > > > render (r.empty? ? {:nothing => true} : {:text => r.to_json}),
                        > > > > :layout => false
                        > > > > end
                        > > > > end
                        > > > > end
                        > > > > #perconbaan: 3
                        > > > > # menunggu hasil dari laporan dari percobaan 1 dan 3 :D
                        > > > >
                        > > > >
                        > > > > 2012/10/11 Iqbal Farabi <farabi.iqbal@... (mailto:farabi.iqbal@...) (mailto:
                        > > farabi.iqbal@... (mailto:farabi.iqbal@...))>
                        > >
                        > > > >
                        > > > > > I see. Dicoba dulu deh, karena memang yg alternatif ini belum saya
                        > > coba
                        > > > > > sama sekali. Thanks all. Nanti saya report lagi hasilnya gimana.
                        > > > > >
                        > > > > > 2012/10/11 Giovanni Sakti <giosakti@... (mailto:giosakti@...) (mailto:
                        > > giosakti@... (mailto:giosakti@...))>
                        > >
                        > > > > >
                        > > > > > > **
                        > > > >
                        > > > > > >
                        > > > > > >
                        > > > > > > baru tune in nih..
                        > > > > > > setuju pakai modifikasi response header..
                        > > > > > >
                        > > > > > > ada beberapa yang nulis, ini nemu barusan:
                        > > http://thedataasylum.com/articles/how-rails-nginx-x-accel-redirect-work-together.html
                        > > > > > >
                        > > > > > > jadi si gem el_finder ga perlu di modifikasi, controller cukup
                        > > terima
                        > > > > > path
                        > > > > > > file yang mau di download dari si elfinder (sory ga familiar sama
                        > > > > > > plugin/gemnya, tapi si elfinder harusnya bisa kirim path file yang
                        > > > > > >
                        > > > > >
                        > > > > >
                        > > > >
                        > > >
                        > >
                        > > mau
                        > > > > > >
                        > > > > >
                        > > > >
                        > > > >
                        > > > > di
                        > > > > > > download ke rails lagi kan?)
                        > > > > > >
                        > > > > > > --
                        > > > > > > Giovanni Sakti
                        > > > > > > Starqle Indonesia
                        > > > > > > http://www.starqle.com
                        > > > > > >
                        > > > > > >
                        > > > > > > On Thursday, October 11, 2012 at 2:17 PM, tejanium wrote:
                        > > > > > >
                        > > > > > > >
                        > > > > > > > Mungkin begini, jangan di require di lib/el_finder.rb tapi di
                        > > include
                        > > > > > di
                        > > > > > > dalem kelas Connectornya di lib/el_finder/connector.rb
                        > > > > > > >
                        > > > > > > > jadi begini
                        > > > > > > >
                        > > > > > > > module ElFinder
                        > > > > > > >
                        > > > > > > > # Represents ElFinder connector on Rails side.
                        > > > > > > > class Connector
                        > > > > > > > include ActionController::DataStreaming
                        > > > > > > >
                        > > > > > > > ...
                        > > > > > > >
                        > > > > > > > end
                        > > > > > > > end
                        > > > > > > > itu jg kalo udah ke load ActionController-nya
                        > > > > > > >
                        > > > > > > > kalo gak mau ribed, cukup modifikasi header, sama header sama
                        > > > > > contentnya
                        > > > > > > aja seperti yang mas Nugroho bilang
                        > > > > > > >
                        > > > > > > > itu kan ada tuh di kelas Connector, @header sama @response,
                        > > tambahin
                        > > > > > aja
                        > > > > > > disana
                        > > > > > > >
                        > > > > > > > CMIIW..
                        > > > > > > >
                        > > > > > > > ________________________________
                        > > > > > > > From: Iqbal Farabi <farabi.iqbal@... (mailto:farabi.iqbal@...) (mailto:
                        > > > > > > >
                        > > > > > >
                        > > > > > >
                        > > > > >
                        > > > > >
                        > > > >
                        > > >
                        > >
                        > > farabi.iqbal@... (mailto:farabi.iqbal@...)) (mailto:
                        > > > > > > >
                        > > > > > >
                        > > > > > >
                        > > > > > > farabi.iqbal%40gmail.com (http://40gmail.com))>
                        > > > > > > > To: id-ruby@yahoogroups.com (mailto:id-ruby%40yahoogroups.com (http://40yahoogroups.com) (
                        > > > > > >
                        > > > > > >
                        > > > > >
                        > > > >
                        > > >
                        > >
                        > > http://40yahoogroups.com))
                        > >
                        > > > > > > > Sent: Thursday, October 11, 2012 1:59 PM
                        > > > > > > > Subject: Re: [id-ruby] Re: Cara send_file di Ruby?
                        > > > > > > >
                        > > > > > > > Hmm.. jadi gini sih,
                        > > > > > > >
                        > > > > > > > Di file el_finer/connector.rb ada module ElFinder dan class
                        > > > > Connector.
                        > > > > > > > Ketika saya coba gunakan send_file dengan plain saja, pesan
                        > > > > > >
                        > > > > >
                        > > > >
                        > > > >
                        > > >
                        > >
                        > > errornya
                        > > > > > >
                        > > > > > > adalah
                        > > > > > > > NoMethodError for class ElFinder::Connector. Lalu saya ubek-ubek
                        > > > > > >
                        > > > > > >
                        > > > > >
                        > > > > >
                        > > > > > sedikit
                        > > > > > > > source code Rails, dan ketemu bahwa send_file ini adanya di
                        > > > > > > > ActionController::DataStreaming (yg mana ini adalah sebuah
                        > > > > > > >
                        > > > > > >
                        > > > > >
                        > > > > >
                        > > > >
                        > > >
                        > >
                        > > module).
                        > > > > > > >
                        > > > > > >
                        > > > > >
                        > > > > >
                        > > > > > Nah,
                        > > > > > > > pesan error itu terjadi karena saya coba panggil dengan cara
                        > > > > > >
                        > > > > >
                        > > > > >
                        > > > >
                        > > >
                        > >
                        > > seperti
                        > > > > > >
                        > > > > >
                        > > > > >
                        > > > > > ini
                        > > > > > > > (sepertinya cara saya agak silly :D):
                        > > > > > > >
                        > > > > > > > 1. Di file utama el_finder.rb saya tambahkan
                        > > > > > > > require 'action_controller/metal/data_streaming'
                        > > > > > > >
                        > > > > > > > 2. Pada file el_finder/connector.rb saya buat method baru untuk
                        > > > > > download,
                        > > > > > > > disitu saya pnggil send_file:
                        > > > > > > > send_file('nama_file')
                        > > > > > > >
                        > > > > > > > 3. Pesan error:
                        > > > > > > >
                        > > > > > > > Started GET
                        > > "/elfinder?cmd=download&target=bG9nb3MvZWxmaW5kZXIucG5n"
                        > > > > > for
                        > > > > > > > 127.0.0.1 at 2012-10-10 19:10:47 +0800
                        > > > > > > > Processing by HomeController#elfinder as HTML
                        > > > > > > > Parameters: {"cmd"=>"download",
                        > > > > > > >
                        > > > > > >
                        > > > > >
                        > > > > >
                        > > > >
                        > > >
                        > >
                        > > "target"=>"bG9nb3MvZWxmaW5kZXIucG5n"}
                        > > > > > > > Completed 500 Internal Server Error in 2ms
                        > > > > > > >
                        > > > > > > > NoMethodError (undefined method `send_file' for
                        > > > > > > > #<ElFinderQbl::Connector:0x00000003ce43e0>):
                        > > > > > > > app/controllers/home_controller.rb:7:in `elfinder'
                        > > > > > > >
                        > > > > > > > 4. Sementara, source code dari Rails untuk send_file ada di sini
                        > > https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/data_streaming.rb
                        > > > > > > >
                        > > > > > > > Terimakasih lho buat bantuan rekan-rekan semua. :)
                        > > > > > > >
                        > > > > > > > 2012/10/11 lyoneil_de_sire <lyoneil_de_sire@... (mailto:lyoneil_de_sire@...) (mailto:
                        > > lyoneil_de_sire@... (mailto:lyoneil_de_sire@...)) (mailto:
                        > > > > > > lyoneil_de_sire%40yahoo.com (http://40yahoo.com))>
                        > > > > >
                        > > > >
                        > > >
                        > >
                        > >
                        > > > > > >
                        > > > > > > >
                        > > > > > > > > **
                        > > > > > > > >
                        > > > > > > > >
                        > > > > > > > > lho sebentar..
                        > > > > > > > >
                        > > > > > > > > errornya "NoMethodError for
                        > > > > ActionController::DataStreaming:Module"?
                        > > > > > > > >
                        > > > > > > > > berarti si send_file nya sendiri mah ketemu yah.. karena dia
                        > > tau
                        > > > > kalo
                        > > > > > > yg
                        > > > > > > > > kita maksud tuh ada di ActionController::DataStreaming .. yg
                        > > > > > > >
                        > > > > > >
                        > > > > > >
                        > > > > >
                        > > > >
                        > > > >
                        > > >
                        > >
                        > > error
                        > > > > > > >
                        > > > > > >
                        > > > > >
                        > > > > >
                        > > > > > tuh
                        > > > > > > > > ditempat lain.. bisa copy paste full error messages nya?
                        > > > > > > >
                        > > > > > > >
                        > > > > > > >
                        > > > > > > > --
                        > > > > > > > Iqbal Farabi
                        > > > > > > > CMO of Starqle Indonesia (iqbal@... (mailto:iqbal@...) (mailto:
                        > > > > > > >
                        > > > > > >
                        > > > > >
                        > > > > >
                        > > > >
                        > > >
                        > >
                        > > iqbal@... (mailto:iqbal@...)) (mailto:
                        > > > > > > >
                        > > > > > >
                        > > > > >
                        > > > > >
                        > > > > > iqbal%40starqle.com (http://40starqle.com)
                        > >
                        > > > > > > ))
                        > > > > > >
                        > > > > > > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/
                        > > )
                        > > > > > > > farabi.iqbal@... (mailto:farabi.iqbal%40gmail.com (http://40gmail.com) (
                        > > > > > >
                        > > > > >
                        > > > >
                        > > >
                        > >
                        > > http://40gmail.com))
                        > >
                        > > > > > >
                        > > > > > >
                        > > > > > > >
                        > > > > > > > [Non-text portions of this message have been removed]
                        > > > > > > >
                        > > > > > > > ------------------------------------
                        > > > > > > >
                        > > > > > > > ID-Ruby
                        > > > > > > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk
                        > > > > > > >
                        > > > > > >
                        > > > > > >
                        > > > > >
                        > > > >
                        > > > >
                        > > > > segala
                        > > > > > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang
                        > > > > >
                        > > > >
                        > > > >
                        > > >
                        > >
                        > > dibuat
                        > > > > > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                        > > > > > > >
                        > > > > > > > http://rubyurl.com/Q8DD
                        > > > > > > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                        > > > > > > >
                        > > > > > > > [Non-text portions of this message have been removed]
                        > > > > > >
                        > > > > > > [Non-text portions of this message have been removed]
                        > > > > >
                        > > > > >
                        > > > > >
                        > > > > > --
                        > > > > > Iqbal Farabi
                        > > > > > CMO of Starqle Indonesia (iqbal@... (mailto:iqbal@...) (mailto:
                        > > > > >
                        > > > >
                        > > >
                        > >
                        > > iqbal@... (mailto:iqbal@...)))
                        > >
                        > > > > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                        > > > > > farabi.iqbal@... (mailto:farabi.iqbal@...)
                        > > > > >
                        > > > >
                        > > >
                        > >
                        > >
                        > > > > >
                        > > > > >
                        > > > > > [Non-text portions of this message have been removed]
                        > > > > >
                        > > > > >
                        > > > > >
                        > > > > > ------------------------------------
                        > > > > >
                        > > > > > ID-Ruby
                        > > > > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk
                        > > > > >
                        > > > >
                        > > >
                        > >
                        > > segala
                        > > > > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang
                        > > > >
                        > > >
                        > >
                        > > dibuat
                        > > > > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                        > > > > >
                        > > > > > http://rubyurl.com/Q8DD
                        > > > > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                        > > > > >
                        > > > >
                        > > > >
                        > > > >
                        > > > > --
                        > > > > *"To accomplish great things, we must not only act, but also dream; not
                        > > > > only plan, but also believe."* *~ Anatole France*
                        > > > >
                        > > > >
                        > > > > [Non-text portions of this message have been removed]
                        > > >
                        > > >
                        > > >
                        > > > --
                        > > > Iqbal Farabi
                        > > > CMO of Starqle Indonesia (iqbal@... (mailto:iqbal@...))
                        > > >
                        > >
                        > >
                        > > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                        > > > farabi.iqbal@... (mailto:farabi.iqbal@...)
                        > > >
                        > >
                        > >
                        > > >
                        > > >
                        > > > [Non-text portions of this message have been removed]
                        > > >
                        > > >
                        > > >
                        > > > ------------------------------------
                        > > >
                        > > > ID-Ruby
                        > > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala
                        > > >
                        > >
                        > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
                        > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                        > > >
                        > > > http://rubyurl.com/Q8DD
                        > > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                        > > >
                        > >
                        > >
                        > > [Non-text portions of this message have been removed]
                        > >
                        >
                        >
                        >
                        > --
                        > Iqbal Farabi
                        > CMO of Starqle Indonesia (iqbal@... (mailto:iqbal@...))
                        > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                        > farabi.iqbal@... (mailto:farabi.iqbal@...)
                        >
                        >
                        > [Non-text portions of this message have been removed]
                        >
                        >
                        >
                        > ------------------------------------
                        >
                        > ID-Ruby
                        > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                        >
                        > http://rubyurl.com/Q8DD
                        > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                        >
                        >
                        >
                        >
                        >




                        [Non-text portions of this message have been removed]
                      • Iqbal Farabi
                        Uhuy! This one works! Sekarang tinggal cari supaya si ElFinder baca file target beneran. Nanti kalo udah lancar semua, insya Allah saya laporin lagi ke milis
                        Message 11 of 26 , Oct 12, 2012
                        • 0 Attachment
                          Uhuy! This one works! Sekarang tinggal cari supaya si ElFinder baca file
                          target beneran. Nanti kalo udah lancar semua, insya Allah saya laporin lagi
                          ke milis ini.

                          Thanks all!

                          2012/10/12 Giovanni Sakti <giosakti@...>

                          > **
                          >
                          >
                          > Coba
                          >
                          > file = File.open(file, "rb")
                          > @response[:content] = file.read
                          >
                          >
                          > --
                          > Giovanni Sakti
                          > Starqle Indonesia
                          > http://www.starqle.com
                          >
                          > On Friday, October 12, 2012 at 2:13 PM, Iqbal Farabi wrote:
                          >
                          > > Hmm.. karena udah di dalem class Connector (di dalem modulnya gitu),
                          > > manggil langsung render gitu raise error:
                          > > NoMethodError (undefined method `render' for
                          > > #<ElFinder::Connector:0x00000003edb770>)
                          > >
                          > > Kalo masih di luar kelas, kaya di action.rb bisa. Tapi masalahnya, di gem
                          > > ini udah begitu modelnya, aksi-aksi lain semua di-handle sama class
                          > > Connector ini.
                          > >
                          > > 2012/10/12 Giovanni Sakti <giosakti@... (mailto:giosakti@...
                          > )>
                          > >
                          > > > **
                          >
                          > > >
                          > > >
                          > > > coba pakai render text
                          > > > render :text => File.open(file)
                          > > >
                          > > >
                          > > > --
                          > > > Giovanni Sakti
                          > > > Starqle Indonesia
                          > > > http://www.starqle.com
                          > > >
                          > > > On Friday, October 12, 2012 at 2:01 PM, Iqbal Farabi wrote:
                          > > >
                          > > > > Mas Yacobus, thanks a lot.
                          > > > >
                          > > > > Saya sudah coba ikuti sarannya, ada sedikit modifikasi, meskipun
                          > masih
                          > > > > gagal tapi ada sedikit kemajuan. Seperti ini:
                          > > > >
                          > > > > 1. Yg di action.rb saya gunakan percobaan #1
                          > > > > 2. Di connector.rb saya cuma ubah @response[:content].size
                          > > > > jadi @response[:content].size.to_s saja karena kalau tidak begitu
                          > selalu
                          > > > > raise NoMethodError 'split' for Fixnum. Yg mana setelah saya cek, yg
                          > > > > bertipe Fixnum ini ya si @response[:content].size. Lalu saya coba
                          > untuk
                          > > > > buka dari @target, tapi @target ternyata class lain dalam gem ini,
                          > nama
                          > > > > class-nya Pathname. Akhirnya saya coba yg standar dulu, saya buka aja
                          > > > >
                          > > >
                          > > > file
                          > > > > sembarang pakai absolut path, code-nya jadi seperti ini:
                          > > > >
                          > > > > def _download
                          > > > > @response[:content] = File.open('/home/iqbal/file_test.txt')
                          > > > > @headers['Content-Type'] = 'application/octet-stream'
                          > > > > @headers['Content-Disposition'] = 'attachment'
                          > > > > @headers['Content-Location'] = '/home/iqbal/file_test.txt'
                          > > > > @headers['Content-Transfer-Encoding'] = 'binary'
                          > > > > @headers['Content-Length'] = @response[:content].size.to_s
                          > > > > @headers['Connection'] = 'close'
                          > > > > else
                          > > > >
                          > > > > Hasilnya, file ter-download, tapi begitu dibuka isinya cuma sebaris
                          > text
                          > > > > berikut:
                          > > > > #<File:0x007fb39412e928>
                          > > > >
                          > > > > Nah, @response[:content] itu harusnya diisi apa ya? Apa saya udah
                          > bener
                          > > > > pake File.open untuk baris itu?
                          > > > >
                          > > > > Thanks lagi sebelumnya.
                          > > > >
                          > > > > Salam hangat,
                          > > > >
                          > > > > 2012/10/11 Yacobus Reinhart <yacobus.reinhart@... (mailto:
                          > yacobus.reinhart@...) (mailto:
                          > > > yacobus.reinhart@... (mailto:yacobus.reinhart@...))>
                          >
                          > > > >
                          > > > > > **
                          > > >
                          > > > > >
                          > > > > >
                          > > > > > hmm,, jangan dilukai Nginx atau Webserver nya, dia gak salah apa2,
                          > coba
                          > > > > > metode ini:
                          > > > > > # sebelumnya hilangkan dulu require2 atau include2 yang di tambal
                          > sulam
                          > > > > > sebelumnya,
                          > > > > > # dan lebih baik kita bikin method serupa dengan send_file dan
                          > > > > >
                          > > > >
                          > > >
                          > > > send_data
                          > > > > >
                          > > > > > # ini buat di connector.rb nya
                          > > > > > # Saya menganggap kalo @target adalah file
                          > > > > > def _download
                          > > > > > @response[:content] = @...
                          > > > > > @headers['Content-Type'] = 'application/octet-stream'
                          > > > > > @headers['Content-Disposition'] = 'attachment'
                          > > > > > @headers['Content-Location'] = @..._filename
                          > > > > > @headers['Content-Transfer-Encoding'] = 'binary'
                          > > > > > @headers['Content-Length'] = @response[:content].size
                          > > > > > @headers['Connection'] = 'close'
                          > > > > > end
                          > > > > >
                          > > > > > # Percobaan berikut untuk di action.rb nya.
                          > > > > > #percobaan: 1
                          > > > > > def el_finder(name = :elfinder, &block)
                          > > > > > self.send(:define_method, name) do
                          > > > > > h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)
                          > > > > > headers.merge!(h)
                          > > > > > render (r.empty? ? {:nothing => true} : {:text => (r[:content] ?
                          > > > > > r[:content] : r.to_json)}), :layout => false
                          > > > > > end
                          > > > > > end
                          > > > > >
                          > > > > > #perconbaan: 2
                          > > > > > def el_finder(name = :elfinder, &block)
                          > > > > > self.send(:define_method, name) do
                          > > > > > h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)
                          > > > > >
                          > > > > > if r[:content]
                          > > > > > h.each_pair do |k,v|
                          > > > > > header k, v
                          > > > > > end
                          > > > > > render text: r[:content], layout: false
                          > > > > > else
                          > > > > > headers.merge!(h)
                          > > > > > render (r.empty? ? {:nothing => true} : {:text => r.to_json}),
                          > > > > > :layout => false
                          > > > > > end
                          > > > > > end
                          > > > > > end
                          > > > > > #perconbaan: 3
                          > > > > > # menunggu hasil dari laporan dari percobaan 1 dan 3 :D
                          > > > > >
                          > > > > >
                          > > > > > 2012/10/11 Iqbal Farabi <farabi.iqbal@... (mailto:
                          > farabi.iqbal@...) (mailto:
                          > > > farabi.iqbal@... (mailto:farabi.iqbal@...))>
                          >
                          > > >
                          > > > > >
                          > > > > > > I see. Dicoba dulu deh, karena memang yg alternatif ini belum
                          > saya
                          > > > coba
                          > > > > > > sama sekali. Thanks all. Nanti saya report lagi hasilnya gimana.
                          > > > > > >
                          > > > > > > 2012/10/11 Giovanni Sakti <giosakti@... (mailto:
                          > giosakti@...) (mailto:
                          > > > giosakti@... (mailto:giosakti@...))>
                          >
                          > > >
                          > > > > > >
                          > > > > > > > **
                          > > > > >
                          > > > > > > >
                          > > > > > > >
                          > > > > > > > baru tune in nih..
                          > > > > > > > setuju pakai modifikasi response header..
                          > > > > > > >
                          > > > > > > > ada beberapa yang nulis, ini nemu barusan:
                          > > >
                          > http://thedataasylum.com/articles/how-rails-nginx-x-accel-redirect-work-together.html
                          > > > > > > >
                          > > > > > > > jadi si gem el_finder ga perlu di modifikasi, controller cukup
                          > > > terima
                          > > > > > > path
                          > > > > > > > file yang mau di download dari si elfinder (sory ga familiar
                          > sama
                          > > > > > > > plugin/gemnya, tapi si elfinder harusnya bisa kirim path file
                          > yang
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > mau
                          > > > > > > >
                          > > > > > >
                          > > > > >
                          > > > > >
                          > > > > > di
                          > > > > > > > download ke rails lagi kan?)
                          > > > > > > >
                          > > > > > > > --
                          > > > > > > > Giovanni Sakti
                          > > > > > > > Starqle Indonesia
                          > > > > > > > http://www.starqle.com
                          > > > > > > >
                          > > > > > > >
                          > > > > > > > On Thursday, October 11, 2012 at 2:17 PM, tejanium wrote:
                          > > > > > > >
                          > > > > > > > >
                          > > > > > > > > Mungkin begini, jangan di require di lib/el_finder.rb tapi di
                          > > > include
                          > > > > > > di
                          > > > > > > > dalem kelas Connectornya di lib/el_finder/connector.rb
                          > > > > > > > >
                          > > > > > > > > jadi begini
                          > > > > > > > >
                          > > > > > > > > module ElFinder
                          > > > > > > > >
                          > > > > > > > > # Represents ElFinder connector on Rails side.
                          > > > > > > > > class Connector
                          > > > > > > > > include ActionController::DataStreaming
                          > > > > > > > >
                          > > > > > > > > ...
                          > > > > > > > >
                          > > > > > > > > end
                          > > > > > > > > end
                          > > > > > > > > itu jg kalo udah ke load ActionController-nya
                          > > > > > > > >
                          > > > > > > > > kalo gak mau ribed, cukup modifikasi header, sama header sama
                          > > > > > > contentnya
                          > > > > > > > aja seperti yang mas Nugroho bilang
                          > > > > > > > >
                          > > > > > > > > itu kan ada tuh di kelas Connector, @header sama @response,
                          > > > tambahin
                          > > > > > > aja
                          > > > > > > > disana
                          > > > > > > > >
                          > > > > > > > > CMIIW..
                          > > > > > > > >
                          > > > > > > > > ________________________________
                          > > > > > > > > From: Iqbal Farabi <farabi.iqbal@... (mailto:
                          > farabi.iqbal@...) (mailto:
                          > > > > > > > >
                          > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > farabi.iqbal@... (mailto:farabi.iqbal@...)) (mailto:
                          > > > > > > > >
                          > > > > > > >
                          > > > > > > >
                          > > > > > > > farabi.iqbal%40gmail.com (http://40gmail.com))>
                          > > > > > > > > To: id-ruby@yahoogroups.com (mailto:
                          > id-ruby%40yahoogroups.com (http://40yahoogroups.com) (
                          >
                          > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > http://40yahoogroups.com))
                          > > >
                          > > > > > > > > Sent: Thursday, October 11, 2012 1:59 PM
                          > > > > > > > > Subject: Re: [id-ruby] Re: Cara send_file di Ruby?
                          > > > > > > > >
                          > > > > > > > > Hmm.. jadi gini sih,
                          > > > > > > > >
                          > > > > > > > > Di file el_finer/connector.rb ada module ElFinder dan class
                          > > > > > Connector.
                          > > > > > > > > Ketika saya coba gunakan send_file dengan plain saja, pesan
                          > > > > > > >
                          > > > > > >
                          > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > errornya
                          > > > > > > >
                          > > > > > > > adalah
                          > > > > > > > > NoMethodError for class ElFinder::Connector. Lalu saya
                          > ubek-ubek
                          > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > > > sedikit
                          > > > > > > > > source code Rails, dan ketemu bahwa send_file ini adanya di
                          > > > > > > > > ActionController::DataStreaming (yg mana ini adalah sebuah
                          > > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > module).
                          > > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > > > Nah,
                          > > > > > > > > pesan error itu terjadi karena saya coba panggil dengan cara
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > seperti
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > > > ini
                          > > > > > > > > (sepertinya cara saya agak silly :D):
                          > > > > > > > >
                          > > > > > > > > 1. Di file utama el_finder.rb saya tambahkan
                          > > > > > > > > require 'action_controller/metal/data_streaming'
                          > > > > > > > >
                          > > > > > > > > 2. Pada file el_finder/connector.rb saya buat method baru
                          > untuk
                          > > > > > > download,
                          > > > > > > > > disitu saya pnggil send_file:
                          > > > > > > > > send_file('nama_file')
                          > > > > > > > >
                          > > > > > > > > 3. Pesan error:
                          > > > > > > > >
                          > > > > > > > > Started GET
                          > > > "/elfinder?cmd=download&target=bG9nb3MvZWxmaW5kZXIucG5n"
                          > > > > > > for
                          > > > > > > > > 127.0.0.1 at 2012-10-10 19:10:47 +0800
                          > > > > > > > > Processing by HomeController#elfinder as HTML
                          > > > > > > > > Parameters: {"cmd"=>"download",
                          > > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > "target"=>"bG9nb3MvZWxmaW5kZXIucG5n"}
                          > > > > > > > > Completed 500 Internal Server Error in 2ms
                          > > > > > > > >
                          > > > > > > > > NoMethodError (undefined method `send_file' for
                          > > > > > > > > #<ElFinderQbl::Connector:0x00000003ce43e0>):
                          > > > > > > > > app/controllers/home_controller.rb:7:in `elfinder'
                          > > > > > > > >
                          > > > > > > > > 4. Sementara, source code dari Rails untuk send_file ada di
                          > sini
                          > > >
                          > https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/data_streaming.rb
                          > > > > > > > >
                          > > > > > > > > Terimakasih lho buat bantuan rekan-rekan semua. :)
                          > > > > > > > >
                          > > > > > > > > 2012/10/11 lyoneil_de_sire <lyoneil_de_sire@...(mailto:
                          > lyoneil_de_sire@...) (mailto:
                          > > > lyoneil_de_sire@... (mailto:lyoneil_de_sire@...)) (mailto:
                          >
                          > > > > > > > lyoneil_de_sire%40yahoo.com (http://40yahoo.com))>
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > >
                          > > > > > > >
                          > > > > > > > >
                          > > > > > > > > > **
                          > > > > > > > > >
                          > > > > > > > > >
                          > > > > > > > > > lho sebentar..
                          > > > > > > > > >
                          > > > > > > > > > errornya "NoMethodError for
                          > > > > > ActionController::DataStreaming:Module"?
                          > > > > > > > > >
                          > > > > > > > > > berarti si send_file nya sendiri mah ketemu yah.. karena
                          > dia
                          > > > tau
                          > > > > > kalo
                          > > > > > > > yg
                          > > > > > > > > > kita maksud tuh ada di ActionController::DataStreaming ..
                          > yg
                          > > > > > > > >
                          > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > error
                          > > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > > > tuh
                          > > > > > > > > > ditempat lain.. bisa copy paste full error messages nya?
                          > > > > > > > >
                          > > > > > > > >
                          > > > > > > > >
                          > > > > > > > > --
                          > > > > > > > > Iqbal Farabi
                          > > > > > > > > CMO of Starqle Indonesia (iqbal@... (mailto:
                          > iqbal@...) (mailto:
                          > > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > iqbal@... (mailto:iqbal@...)) (mailto:
                          >
                          > > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > > > iqbal%40starqle.com (http://40starqle.com)
                          > > >
                          > > > > > > > ))
                          > > > > > > >
                          > > > > > > > > Blogger at Tech in Asia (
                          > http://www.techinasia.com/author/iqbal/
                          > > > )
                          > > > > > > > > farabi.iqbal@... (mailto:farabi.iqbal%40gmail.com (
                          > http://40gmail.com) (
                          >
                          > > > > > > >
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > http://40gmail.com))
                          > > >
                          > > > > > > >
                          > > > > > > >
                          > > > > > > > >
                          > > > > > > > > [Non-text portions of this message have been removed]
                          > > > > > > > >
                          > > > > > > > > ------------------------------------
                          > > > > > > > >
                          > > > > > > > > ID-Ruby
                          > > > > > > > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby,
                          > termasuk
                          > > > > > > > >
                          > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > >
                          > > > > >
                          > > > > > segala
                          > > > > > > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program
                          > yang
                          > > > > > >
                          > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > dibuat
                          > > > > > > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                          > > > > > > > >
                          > > > > > > > > http://rubyurl.com/Q8DD
                          > > > > > > > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                          > > > > > > > >
                          > > > > > > > > [Non-text portions of this message have been removed]
                          > > > > > > >
                          > > > > > > > [Non-text portions of this message have been removed]
                          > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > > > --
                          > > > > > > Iqbal Farabi
                          > > > > > > CMO of Starqle Indonesia (iqbal@... (mailto:
                          > iqbal@...) (mailto:
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > iqbal@... (mailto:iqbal@...)))
                          >
                          > > >
                          > > > > > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/
                          > )
                          > > > > > > farabi.iqbal@... (mailto:farabi.iqbal@...)
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > >
                          > > > > > >
                          > > > > > >
                          > > > > > > [Non-text portions of this message have been removed]
                          > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > > > ------------------------------------
                          > > > > > >
                          > > > > > > ID-Ruby
                          > > > > > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >
                          > > > segala
                          > > > > > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang
                          > > > > >
                          > > > >
                          > > >
                          > > > dibuat
                          > > > > > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                          > > > > > >
                          > > > > > > http://rubyurl.com/Q8DD
                          > > > > > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                          > > > > > >
                          > > > > >
                          > > > > >
                          > > > > >
                          > > > > > --
                          > > > > > *"To accomplish great things, we must not only act, but also
                          > dream; not
                          > > > > > only plan, but also believe."* *~ Anatole France*
                          > > > > >
                          > > > > >
                          > > > > > [Non-text portions of this message have been removed]
                          > > > >
                          > > > >
                          > > > >
                          > > > > --
                          > > > > Iqbal Farabi
                          > > > > CMO of Starqle Indonesia (iqbal@... (mailto:
                          > iqbal@...))
                          > > > >
                          > > >
                          > > >
                          > > > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                          > > > > farabi.iqbal@... (mailto:farabi.iqbal@...)
                          > > > >
                          > > >
                          > > >
                          > > > >
                          > > > >
                          > > > > [Non-text portions of this message have been removed]
                          > > > >
                          > > > >
                          > > > >
                          > > > > ------------------------------------
                          > > > >
                          > > > > ID-Ruby
                          > > > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk
                          > segala
                          > > > >
                          > > >
                          > > > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
                          > > > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                          > > > >
                          > > > > http://rubyurl.com/Q8DD
                          > > > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                          > > > >
                          > > >
                          > > >
                          > > > [Non-text portions of this message have been removed]
                          > > >
                          > >
                          > >
                          > >
                          > > --
                          > > Iqbal Farabi
                          > > CMO of Starqle Indonesia (iqbal@... (mailto:iqbal@...))
                          > > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                          > > farabi.iqbal@... (mailto:farabi.iqbal@...)
                          > >
                          > >
                          > > [Non-text portions of this message have been removed]
                          > >
                          > >
                          > >
                          > > ------------------------------------
                          > >
                          > > ID-Ruby
                          > > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala
                          > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
                          > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                          > >
                          > > http://rubyurl.com/Q8DD
                          > > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                          > >
                          > >
                          > >
                          > >
                          > >
                          >
                          > [Non-text portions of this message have been removed]
                          >
                          >
                          >



                          --
                          Iqbal Farabi
                          CMO of Starqle Indonesia (iqbal@...)
                          Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                          farabi.iqbal@...


                          [Non-text portions of this message have been removed]
                        • Yacobus Reinhart
                          Mantab, bal :D request constributor aja buat method download :D you re rock!! [Non-text portions of this message have been removed]
                          Message 12 of 26 , Oct 12, 2012
                          • 0 Attachment
                            Mantab, bal :D request constributor aja buat method download :D you're
                            rock!!


                            [Non-text portions of this message have been removed]
                          • Iqbal Farabi
                            Hehe, lah, justru mase yg mantap. Won t get this far without your help, Mas Yacobus. Nuhun nuhun. On Fri, Oct 12, 2012 at 3:23 PM, Yacobus Reinhart
                            Message 13 of 26 , Oct 12, 2012
                            • 0 Attachment
                              Hehe, lah, justru mase yg mantap. Won't get this far without your help, Mas
                              Yacobus. Nuhun nuhun.

                              On Fri, Oct 12, 2012 at 3:23 PM, Yacobus Reinhart <
                              yacobus.reinhart@...> wrote:

                              > **
                              >
                              >
                              > Mantab, bal :D request constributor aja buat method download :D you're
                              > rock!!
                              >
                              >
                              > [Non-text portions of this message have been removed]
                              >
                              >
                              > --
                              Iqbal Farabi
                              CMO of Starqle Indonesia (iqbal@...)
                              Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                              farabi.iqbal@...


                              [Non-text portions of this message have been removed]
                            • Yacobus Reinhart
                              coba liat connector.rb line 75, 327 dan 336. Kemaren saya mengacu pada itu. Nah line 75 mengarah ke line 97, klo dilihat dari flow processnya kamu bisa
                              Message 14 of 26 , Oct 12, 2012
                              • 0 Attachment
                                coba liat connector.rb line 75, 327 dan 336. Kemaren saya mengacu pada itu.
                                Nah line 75 mengarah ke line 97, klo dilihat dari flow processnya kamu bisa
                                tambahin satu line tambahan setelah line 75.
                                @target = File.new(@target) if @..._a?(String)

                                di method download kamu tambahin ini:
                                response[:content] = @...

                                # klo berhasil you owe me marlb*ro sebungkus (kidding :p )

                                On Fri, Oct 12, 2012 at 2:25 PM, Iqbal Farabi <farabi.iqbal@...>wrote:

                                > **
                                >
                                >
                                > Hehe, lah, justru mase yg mantap. Won't get this far without your help, Mas
                                > Yacobus. Nuhun nuhun.
                                >
                                > On Fri, Oct 12, 2012 at 3:23 PM, Yacobus Reinhart <
                                > yacobus.reinhart@...> wrote:
                                >
                                > > **
                                >
                                > >
                                > >
                                > > Mantab, bal :D request constributor aja buat method download :D you're
                                > > rock!!
                                > >
                                > >
                                > > [Non-text portions of this message have been removed]
                                > >
                                > >
                                > > --
                                > Iqbal Farabi
                                > CMO of Starqle Indonesia (iqbal@...)
                                > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                                > farabi.iqbal@...
                                >
                                > [Non-text portions of this message have been removed]
                                >
                                >
                                >



                                --
                                *"To accomplish great things, we must not only act, but also dream; not
                                only plan, but also believe."* *~ Anatole France*


                                [Non-text portions of this message have been removed]
                              • Yacobus Reinhart
                                eh jangan deh bal, mending tambahin method dibawah ini didalam method download aja: @target = File.new(@target) if @target.is_a?(String) takutnya bikin kacau
                                Message 15 of 26 , Oct 12, 2012
                                • 0 Attachment
                                  eh jangan deh bal, mending tambahin method dibawah ini didalam method
                                  download aja:
                                  @target = File.new(@target) if @..._a?(String)

                                  takutnya bikin kacau yang lainnya yang mengharapkan value dari @target

                                  On Fri, Oct 12, 2012 at 2:33 PM, Yacobus Reinhart <
                                  yacobus.reinhart@...> wrote:

                                  > coba liat connector.rb line 75, 327 dan 336. Kemaren saya mengacu pada itu.
                                  > Nah line 75 mengarah ke line 97, klo dilihat dari flow processnya kamu
                                  > bisa tambahin satu line tambahan setelah line 75.
                                  > @target = File.new(@target) if @..._a?(String)
                                  >
                                  > di method download kamu tambahin ini:
                                  > response[:content] = @...
                                  >
                                  > # klo berhasil you owe me marlb*ro sebungkus (kidding :p )
                                  >
                                  >
                                  > On Fri, Oct 12, 2012 at 2:25 PM, Iqbal Farabi <farabi.iqbal@...>wrote:
                                  >
                                  >> **
                                  >>
                                  >>
                                  >> Hehe, lah, justru mase yg mantap. Won't get this far without your help,
                                  >> Mas
                                  >> Yacobus. Nuhun nuhun.
                                  >>
                                  >> On Fri, Oct 12, 2012 at 3:23 PM, Yacobus Reinhart <
                                  >> yacobus.reinhart@...> wrote:
                                  >>
                                  >> > **
                                  >>
                                  >> >
                                  >> >
                                  >> > Mantab, bal :D request constributor aja buat method download :D you're
                                  >> > rock!!
                                  >> >
                                  >> >
                                  >> > [Non-text portions of this message have been removed]
                                  >> >
                                  >> >
                                  >> > --
                                  >> Iqbal Farabi
                                  >> CMO of Starqle Indonesia (iqbal@...)
                                  >> Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                                  >> farabi.iqbal@...
                                  >>
                                  >> [Non-text portions of this message have been removed]
                                  >>
                                  >>
                                  >>
                                  >
                                  >
                                  >
                                  > --
                                  > *"To accomplish great things, we must not only act, but also dream; not
                                  > only plan, but also believe."* *~ Anatole France*
                                  >



                                  --
                                  *"To accomplish great things, we must not only act, but also dream; not
                                  only plan, but also believe."* *~ Anatole France*


                                  [Non-text portions of this message have been removed]
                                • Iqbal Farabi
                                  Dicoba dulu ya... On Fri, Oct 12, 2012 at 3:38 PM, Yacobus Reinhart
                                  Message 16 of 26 , Oct 12, 2012
                                  • 0 Attachment
                                    Dicoba dulu ya...

                                    On Fri, Oct 12, 2012 at 3:38 PM, Yacobus Reinhart <
                                    yacobus.reinhart@...> wrote:

                                    > eh jangan deh bal, mending tambahin method dibawah ini didalam method
                                    > download aja:
                                    > @target = File.new(@target) if @..._a?(String)
                                    >
                                    > takutnya bikin kacau yang lainnya yang mengharapkan value dari @target
                                    >
                                    > On Fri, Oct 12, 2012 at 2:33 PM, Yacobus Reinhart <
                                    > yacobus.reinhart@...> wrote:
                                    >
                                    > > coba liat connector.rb line 75, 327 dan 336. Kemaren saya mengacu pada
                                    > itu.
                                    > > Nah line 75 mengarah ke line 97, klo dilihat dari flow processnya kamu
                                    > > bisa tambahin satu line tambahan setelah line 75.
                                    > > @target = File.new(@target) if @..._a?(String)
                                    > >
                                    > > di method download kamu tambahin ini:
                                    > > response[:content] = @...
                                    > >
                                    > > # klo berhasil you owe me marlb*ro sebungkus (kidding :p )
                                    > >
                                    > >
                                    > > On Fri, Oct 12, 2012 at 2:25 PM, Iqbal Farabi <farabi.iqbal@...
                                    > >wrote:
                                    > >
                                    > >> **
                                    > >>
                                    > >>
                                    > >> Hehe, lah, justru mase yg mantap. Won't get this far without your help,
                                    > >> Mas
                                    > >> Yacobus. Nuhun nuhun.
                                    > >>
                                    > >> On Fri, Oct 12, 2012 at 3:23 PM, Yacobus Reinhart <
                                    > >> yacobus.reinhart@...> wrote:
                                    > >>
                                    > >> > **
                                    > >>
                                    > >> >
                                    > >> >
                                    > >> > Mantab, bal :D request constributor aja buat method download :D you're
                                    > >> > rock!!
                                    > >> >
                                    > >> >
                                    > >> > [Non-text portions of this message have been removed]
                                    > >> >
                                    > >> >
                                    > >> > --
                                    > >> Iqbal Farabi
                                    > >> CMO of Starqle Indonesia (iqbal@...)
                                    > >> Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                                    > >> farabi.iqbal@...
                                    > >>
                                    > >> [Non-text portions of this message have been removed]
                                    > >>
                                    > >>
                                    > >>
                                    > >
                                    > >
                                    > >
                                    > > --
                                    > > *"To accomplish great things, we must not only act, but also dream; not
                                    > > only plan, but also believe."* *~ Anatole France*
                                    > >
                                    >
                                    >
                                    >
                                    > --
                                    > *"To accomplish great things, we must not only act, but also dream; not
                                    > only plan, but also believe."* *~ Anatole France*
                                    >
                                    >
                                    > [Non-text portions of this message have been removed]
                                    >
                                    >
                                    >
                                    > ------------------------------------
                                    >
                                    > ID-Ruby
                                    > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala
                                    > varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
                                    > dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                                    >
                                    > http://rubyurl.com/Q8DD
                                    > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                                    >
                                    >
                                    >
                                    >
                                    >


                                    --
                                    Iqbal Farabi
                                    CMO of Starqle Indonesia (iqbal@...)
                                    Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                                    farabi.iqbal@...


                                    [Non-text portions of this message have been removed]
                                  • Iqbal Farabi
                                    Wah, maaf kengkawan, saya telat lapornya. Oke, ini hasil akhir, alhamdulillah sudah berjalan seperti yang saya mau: 1. Di file action.rb, menggunakan percobaan
                                    Message 17 of 26 , Oct 16, 2012
                                    • 0 Attachment
                                      Wah, maaf kengkawan, saya telat lapornya. Oke, ini hasil akhir,
                                      alhamdulillah sudah berjalan seperti yang saya mau:

                                      1. Di file action.rb, menggunakan percobaan #1 dari Mas Yacobus:
                                      def el_finder(name = :elfinder, &block)
                                      self.send(:define_method, name) do
                                      h, r = ElFinder::Connector.new(instance_eval(&block)).run(params)
                                      headers.merge!(h)
                                      render (r.empty? ? {:nothing => true} : {:text => (r[:content] ?
                                      r[:content] : r.to_json)}), :layout => false
                                      end
                                      end

                                      2. Di file lib/connector.rb menggabungkan saran dari Mas Yacobus dan Yovan
                                      serta sedikit copas dari code di method lainnya di gem tersebut:

                                      def _download(target = nil)
                                      target ||= @target

                                      if target.nil?
                                      _open(@root)
                                      return
                                      end

                                      if perms_for(target)[:read] == false
                                      @response[:error] = 'Access Denied'
                                      return
                                      end

                                      if target.file?
                                      file = File.open(@..._s, "rb")
                                      @response[:content] = file.read
                                      @headers['Content-Type'] = 'application/octet-stream'
                                      @headers['Content-Disposition'] = "attachment;
                                      filename=#{@..._s}"
                                      @headers['Content-Location'] = @..._s
                                      @headers['Content-Transfer-Encoding'] = 'binary'
                                      @headers['Content-Length'] = @response[:content].size.to_s
                                      @headers['Connection'] = 'close'
                                      else
                                      command_not_implemented
                                      end
                                      end # of download

                                      It works fine for now. Again, thanks all.

                                      Buat Mas Yacobus, ini ada oleh-oleh:
                                      http://upload.wikimedia.org/wikipedia/commons/c/ca/American_duty-free_Marlboro.jpg
                                      :D

                                      On Fri, Oct 12, 2012 at 3:40 PM, Iqbal Farabi <farabi.iqbal@...>wrote:

                                      > Dicoba dulu ya...
                                      >
                                      >
                                      > On Fri, Oct 12, 2012 at 3:38 PM, Yacobus Reinhart <
                                      > yacobus.reinhart@...> wrote:
                                      >
                                      >> eh jangan deh bal, mending tambahin method dibawah ini didalam method
                                      >> download aja:
                                      >> @target = File.new(@target) if @..._a?(String)
                                      >>
                                      >> takutnya bikin kacau yang lainnya yang mengharapkan value dari @target
                                      >>
                                      >> On Fri, Oct 12, 2012 at 2:33 PM, Yacobus Reinhart <
                                      >> yacobus.reinhart@...> wrote:
                                      >>
                                      >> > coba liat connector.rb line 75, 327 dan 336. Kemaren saya mengacu pada
                                      >> itu.
                                      >> > Nah line 75 mengarah ke line 97, klo dilihat dari flow processnya kamu
                                      >> > bisa tambahin satu line tambahan setelah line 75.
                                      >> > @target = File.new(@target) if @..._a?(String)
                                      >> >
                                      >> > di method download kamu tambahin ini:
                                      >> > response[:content] = @...
                                      >> >
                                      >> > # klo berhasil you owe me marlb*ro sebungkus (kidding :p )
                                      >> >
                                      >> >
                                      >> > On Fri, Oct 12, 2012 at 2:25 PM, Iqbal Farabi <farabi.iqbal@...
                                      >> >wrote:
                                      >> >
                                      >> >> **
                                      >> >>
                                      >> >>
                                      >> >> Hehe, lah, justru mase yg mantap. Won't get this far without your help,
                                      >> >> Mas
                                      >> >> Yacobus. Nuhun nuhun.
                                      >> >>
                                      >> >> On Fri, Oct 12, 2012 at 3:23 PM, Yacobus Reinhart <
                                      >> >> yacobus.reinhart@...> wrote:
                                      >> >>
                                      >> >> > **
                                      >> >>
                                      >> >> >
                                      >> >> >
                                      >> >> > Mantab, bal :D request constributor aja buat method download :D
                                      >> you're
                                      >> >> > rock!!
                                      >> >> >
                                      >> >> >
                                      >> >> > [Non-text portions of this message have been removed]
                                      >> >> >
                                      >> >> >
                                      >> >> > --
                                      >> >> Iqbal Farabi
                                      >> >> CMO of Starqle Indonesia (iqbal@...)
                                      >> >> Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                                      >> >> farabi.iqbal@...
                                      >> >>
                                      >> >> [Non-text portions of this message have been removed]
                                      >> >>
                                      >> >>
                                      >> >>
                                      >> >
                                      >> >
                                      >> >
                                      >> > --
                                      >> > *"To accomplish great things, we must not only act, but also dream; not
                                      >> > only plan, but also believe."* *~ Anatole France*
                                      >> >
                                      >>
                                      >>
                                      >>
                                      >> --
                                      >> *"To accomplish great things, we must not only act, but also dream; not
                                      >> only plan, but also believe."* *~ Anatole France*
                                      >>
                                      >>
                                      >> [Non-text portions of this message have been removed]
                                      >>
                                      >>
                                      >>
                                      >> ------------------------------------
                                      >>
                                      >> ID-Ruby
                                      >> Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala
                                      >> varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
                                      >> dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
                                      >>
                                      >> http://rubyurl.com/Q8DD
                                      >> http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
                                      >>
                                      >>
                                      >>
                                      >>
                                      >>
                                      >
                                      >
                                      > --
                                      > Iqbal Farabi
                                      > CMO of Starqle Indonesia (iqbal@...)
                                      > Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                                      > farabi.iqbal@...
                                      >
                                      >


                                      --
                                      Iqbal Farabi
                                      CMO of Starqle Indonesia (iqbal@...)
                                      Blogger at Tech in Asia (http://www.techinasia.com/author/iqbal/)
                                      farabi.iqbal@...


                                      [Non-text portions of this message have been removed]
                                    Your message has been successfully submitted and would be delivered to recipients shortly.