Why , when I have in a controller the following code and an existent temp.csv file, def download if @params[''acceptDisclaimer''] == ''Yes'' send_file ''/temp.csv'' end end Do I get ActionController::MissingFile in Main#download Cannot read file /temp.csv /app/controllers/main_controller.rb:22:in `download'' script/server:49 Where is /temp.csv point to? public/temp.csv?
using an absolute path would be the biggest problem. send_file is not redirecting the user. so your line is looking for /temp.csv NOT $application/public/temp.csv or $application/temp.csv and is NOT forwarding the user to www.yoursite.com/temp.csv. On 8/10/05, Skriloff, Nicholas <SkriloffN-f4ouqFeUts2a0hU+lRkGgZVzexx5G7lz@public.gmane.org> wrote:> Why , when I have in a controller the following code and an existent > temp.csv file, > def download > if @params[''acceptDisclaimer''] == ''Yes'' > send_file ''/temp.csv'' > end > end > Do I get > ActionController::MissingFile in Main#download > > Cannot read file /temp.csv > > /app/controllers/main_controller.rb:22:in `download'' > script/server:49 > > Where is /temp.csv point to? public/temp.csv? > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Zachery Hostens <zacheryph-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Are you saying that /temp.csv does not mean start from root? -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Zachery Hostens Sent: Thursday, August 11, 2005 12:25 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] how to use send_file using an absolute path would be the biggest problem. send_file is not redirecting the user. so your line is looking for /temp.csv NOT $application/public/temp.csv or $application/temp.csv and is NOT forwarding the user to www.yoursite.com/temp.csv. On 8/10/05, Skriloff, Nicholas <SkriloffN-f4ouqFeUts2a0hU+lRkGgZVzexx5G7lz@public.gmane.org> wrote:> Why , when I have in a controller the following code and an existent > temp.csv file, > def download > if @params[''acceptDisclaimer''] == ''Yes'' > send_file ''/temp.csv'' > end > end > Do I get > ActionController::MissingFile in Main#download > > Cannot read file /temp.csv > > /app/controllers/main_controller.rb:22:in `download'' > script/server:49 > > Where is /temp.csv point to? public/temp.csv? > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Zachery Hostens <zacheryph-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
/temp.csv DOES mean start from root. Root is probably not where you want to start. There''s a difference between "root" and RAILS_ROOT. RAILS_ROOT is probably closer to what you''re looking for. try something like RAILS_ROOT + ''/temp.csv'' or RAILS_ROOT + ''/public/temp.csv'', depending on where your file is. Tyler On 8/11/05, Skriloff, Nicholas <SkriloffN-f4ouqFeUts2a0hU+lRkGgZVzexx5G7lz@public.gmane.org> wrote:> Are you saying that /temp.csv does not mean start from root? > > -----Original Message----- > From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Zachery > Hostens > Sent: Thursday, August 11, 2005 12:25 AM > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Rails] how to use send_file > > using an absolute path would be the biggest problem. > > send_file is not redirecting the user. so your line is looking for > > /temp.csv > > NOT $application/public/temp.csv or $application/temp.csv > > and is NOT forwarding the user to > > www.yoursite.com/temp.csv. > > > On 8/10/05, Skriloff, Nicholas <SkriloffN-f4ouqFeUts2a0hU+lRkGgZVzexx5G7lz@public.gmane.org> wrote: > > Why , when I have in a controller the following code and an existent > > temp.csv file, > > def download > > if @params[''acceptDisclaimer''] == ''Yes'' > > send_file ''/temp.csv'' > > end > > end > > Do I get > > ActionController::MissingFile in Main#download > > > > Cannot read file /temp.csv > > > > /app/controllers/main_controller.rb:22:in `download'' > > script/server:49 > > > > Where is /temp.csv point to? public/temp.csv? > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Zachery Hostens <zacheryph-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Is $application a built in rails app root? -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Tyler Kiley Sent: Thursday, August 11, 2005 10:10 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] how to use send_file /temp.csv DOES mean start from root. Root is probably not where you want to start. There''s a difference between "root" and RAILS_ROOT. RAILS_ROOT is probably closer to what you''re looking for. try something like RAILS_ROOT + ''/temp.csv'' or RAILS_ROOT + ''/public/temp.csv'', depending on where your file is. Tyler On 8/11/05, Skriloff, Nicholas <SkriloffN-f4ouqFeUts2a0hU+lRkGgZVzexx5G7lz@public.gmane.org> wrote:> Are you saying that /temp.csv does not mean start from root? > > -----Original Message----- > From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Zachery > Hostens > Sent: Thursday, August 11, 2005 12:25 AM > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Rails] how to use send_file > > using an absolute path would be the biggest problem. > > send_file is not redirecting the user. so your line is looking for > > /temp.csv > > NOT $application/public/temp.csv or $application/temp.csv > > and is NOT forwarding the user to > > www.yoursite.com/temp.csv. > > > On 8/10/05, Skriloff, Nicholas <SkriloffN-f4ouqFeUts2a0hU+lRkGgZVzexx5G7lz@public.gmane.org> wrote: > > Why , when I have in a controller the following code and an existent > > temp.csv file, > > def download > > if @params[''acceptDisclaimer''] == ''Yes'' > > send_file ''/temp.csv'' > > end > > end > > Do I get > > ActionController::MissingFile in Main#download > > > > Cannot read file /temp.csv > > > > /app/controllers/main_controller.rb:22:in `download'' > > script/server:49 > > > > Where is /temp.csv point to? public/temp.csv? > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Zachery Hostens <zacheryph-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails