Hi, How would an action that sends a file (build dynamically using data from model) to user work in REST application? Is it ok if I add "download" action to my controller and routes.rb (:collection => {:download => :get})? Or should it be done differently? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Xeno Campanoli
2007-Jun-15 22:07 UTC
Where''s the configuration to set my web server? It''s using WEBrick right now.
I cannot find anything in my resulting tree made with "rails something". I apologize if I''m missing something obvious. xc -- The only sustainable organizing methods focus not on scale, but on good design of the functional unit, not on winning battles, but on preservation. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/15/07, Szymon Nowak <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi, > > How would an action that sends a file (build dynamically using data from > model) to user work in REST application? Is it ok if I add "download" > action to my controller and routes.rb (:collection => {:download => > :get})? Or should it be done differently?If you''re talking about resources, it makes more sense to make that file it''s own resource. map.resources :foos do |foo| foo.resource :download # assuming there''s one ''dynamic'' file per Foo record end GET /foos/1/download # downloads/index action. Part of the rails restful routing style was to stick to the core 7 actions (index, show, new, edit, update, create, destroy) by bringing out the "inner resource". This makes more sense if folks can also update or destroy the extra resource. Then you wouldn''t need several actions like show_download, create_download, etc. -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Conrad Taylor
2007-Jun-15 23:31 UTC
Re: Where''s the configuration to set my web server? It''s using WEBrick right now.
Hi, could you provide more info about your environment and the webserver you''re trying to use? Rails version? Webserver? Thanks, -Conrad On 6/15/07, Xeno Campanoli <xcampanoli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I cannot find anything in my resulting tree made with "rails something". > I apologize if I''m missing something obvious. > > xc > -- > The only sustainable organizing methods focus not on scale, > but on good design of the functional unit, > not on winning battles, but on preservation. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks. Actually I don''t need to create a file for every resource item (:foo),but thanks anyway - maybe I''ll add such functionality, now when I know how to do it :) I''d like to be able to access results of my resources index action (http://localhost/foos) in 3 ways - html format - by viewing it in a browser, plain text - by getting data using GET "Accept: text/plain" (works fine) and a plain text file, which would contain exactly same results as previous option, but could be downloaded from the index page by clicking a button. How to do (correctly) something like that? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Xeno Campanoli
2007-Jun-16 15:29 UTC
Re: Where''s the configuration to set my web server? It''s using WEBrick right now.
Conrad Taylor wrote:> Hi, could you provide more info about your environment and the > webserver you''re trying to use? > Rails version? Webserver?Sure. Thanks. I''m on Ubuntu Gutsy (like unstable in Debian perhaps) recently installed: root@radioflyer:~/chapter-1# rails -v Rails 1.2.3 I have this code in chapter-1/scripts/server: root@radioflyer:~/chapter-1# cat script/server;echo #!/usr/bin/env ruby require File.dirname(__FILE__) + ''/../config/boot'' require ''commands/server'' root@radioflyer:~/chapter-1# --snip-- which differs from what I see on page 7 of _Up_and_Running_. Presumably things have been radically refactored since that publishing.> > Thanks, > > -Conrad > > > On 6/15/07, Xeno Campanoli <xcampanoli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> I cannot find anything in my resulting tree made with "rails something". >> I apologize if I''m missing something obvious. >> >> xc >> -- >> The only sustainable organizing methods focus not on scale, >> but on good design of the functional unit, >> not on winning battles, but on preservation. >> > > > >-- The only sustainable organizing methods focus not on scale, but on good design of the functional unit, not on winning battles, but on preservation. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---