bradlyf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-13 00:43 UTC
How to handle static pages?
So in true Summer of Rails fashion I am trying to build my first Ruby on Rails application, but what I haven''t been able to find any information on is how to handle my gosh darn static pages. For example my About page. I believe I should keep it handled in Rails so that it can use the standard template, but I don''t know where to define it and put the HTML. Thanks in advanced for any help! -Bradly --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
So in true Summer of Rails fashion I am trying to build my first Ruby on Rails application, but what I haven''t been able to find any information on is how to handle my gosh darn static pages. For example my About page. I believe I should keep it handled in Rails so that it can use the standard template, but I don''t know where to define it and put the HTML. Thanks in advanced for any help! -Bradly --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bradly wrote:> So in true Summer of Rails fashion I am trying to build my first Ruby > on Rails application, but what I haven''t been able to find any > information on is how to handle my gosh darn static pages. For example > my About page. I believe I should keep it handled in Rails so that it > can use the standard template, but I don''t know where to define it and > put the HTML. Thanks in advanced for any help! > > -Bradly >I just have a controller that handles all ''static'' pages, wrapping the html from the view in the layout then making sure it is cached. This means I have to remove the cached page by hand which is fine for small sites. If and when I never need something like this on a larger site I would come up with a cache clearing and regenerating solution. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Just drop it into public and it will be served up just fine. By default rails will check inside public if it doesn''t have a route that matches the request. The newer preferred/scalable way of doing things involves taking a http server like nginx and using it to serve up the static pages from public while you proxy "rails" requests through to a mongrel cluster running alongside. But even in that case the norm is to put the static pages inside the public folder as well. Bottom line is just drop into public, step back and watch the magic happen! John W Higgins wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org On 9/12/06, bradlyf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <bradlyf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > So in true Summer of Rails fashion I am trying to build my first Ruby > on Rails application, but what I haven''t been able to find any > information on is how to handle my gosh darn static pages. For example > my About page. I believe I should keep it handled in Rails so that it > can use the standard template, but I don''t know where to define it and > put the HTML. Thanks in advanced for any help! > > -Bradly > > > > >-- John W Higgins wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Why dont you try WebGen (on RubyForge). Regards, Swanand. On 9/13/06, John Higgins <wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Just drop it into public and it will be served up just fine. By default > rails will check inside public if it doesn''t have a route that matches the > request. > > The newer preferred/scalable way of doing things involves taking a http > server like nginx and using it to serve up the static pages from public > while you proxy "rails" requests through to a mongrel cluster running > alongside. But even in that case the norm is to put the static pages inside > the public folder as well. > > Bottom line is just drop into public, step back and watch the magic > happen! > > John W Higgins > wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > On 9/12/06, bradlyf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <bradlyf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > So in true Summer of Rails fashion I am trying to build my first Ruby > > on Rails application, but what I haven''t been able to find any > > information on is how to handle my gosh darn static pages. For example > > my About page. I believe I should keep it handled in Rails so that it > > can use the standard template, but I don''t know where to define it and > > put the HTML. Thanks in advanced for any help! > > > > -Bradly > > > > > > > > > > > > > -- > John W Higgins > wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> Subject: [Rails] How to handle static pages? > > > So in true Summer of Rails fashion I am trying to build my first Ruby > on Rails application, but what I haven''t been able to find any > information on is how to handle my gosh darn static pages. For example > my About page. I believe I should keep it handled in Rails so that it > can use the standard template, but I don''t know where to define it and > put the HTML. Thanks in advanced for any help! > > -Bradly >You can put them anywhere in your rails ''public'' subdirectory. In my case, I generally want one site template that I can change in one place, so I tend to put the content into a controller. For example, my welcome controller has an about action, and a view that renders the static data. Production Rails can cache this so that the web server can serve it on subsequent requests. What''s a bit more annoying is protecting static content. In certain cases, I only want to emit content if the user is logged in and has a particular role. /public is no good in this case, as by definition, it bypasses rails. In this case, I have a special route that always sends to controller protected, method render_static. The send_file command is needed, and you have to keep track of content types to boot. You didn''t say if this was what you wanted, so I haven''t elaborated much. Let me know if you need more info. HTH. Regards, Rich --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Hi Bradly, 2006/9/13, bradlyf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <bradlyf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > So in true Summer of Rails fashion I am trying to build my first Ruby > on Rails application, but what I haven''t been able to find any > information on is how to handle my gosh darn static pages. For example > my About page. I believe I should keep it handled in Rails so that it > can use the standard template, but I don''t know where to define it and > put the HTML. Thanks in advanced for any help!Try Comatose, a rails plugin: http://www.mattmccray.com/archive/2006/07/01/Comatose_a_Micro_CMS_Plugin HTH Beate --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---