Hi, I have a very noob question. I just started on RoR this week, glad to be on board. I''m just wondering where I edit the first page when people come to the site, index.html. There seems to be one in the public folder. However, how do I make that a dynamic page? Thanks -- 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 -~----------~----~----~----~------~----~------~--~---
Rename or remove that file and add a default route. Look in your routes.rb file. You''ll see something like this... # You can have the root of your site routed by hooking up '''' # -- just remember to delete public/index.html. # map.connect '''', :controller => "index" Uncomment that and generate an index controller or whatever name you like. -- James Mitchell On Jun 6, 2007, at 5:22 PM, Newby wrote:> > Hi, > > I have a very noob question. I just started on RoR this week, glad > to be > on board. I''m just wondering where I edit the first page when people > come to the site, index.html. There seems to be one in the public > folder. However, how do I make that a dynamic page? > > Thanks > > -- > 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 -~----------~----~----~----~------~----~------~--~---
dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org
2007-Jun-06 21:41 UTC
Re: Very Noob Question: index.html
Hi -- On Wed, 6 Jun 2007, Newby wrote:> > Hi, > > I have a very noob question. I just started on RoR this week, glad to be > on board.Welcome!> I''m just wondering where I edit the first page when people > come to the site, index.html. There seems to be one in the public > folder. However, how do I make that a dynamic page?Rails uses its routing system to figure out what to do given a particular URL. That applies even when the URL is empty: you have to register a routing rule that says what to do in response to the empty URL. To do this, look inside the file config/routes.rb. You''ll see a section like this: # You can have the root of your site routed by hooking up '''' # -- just remember to delete public/index.html. # map.connect '''', :controller => "welcome" You want to uncomment the third line, and customize it to correspond to whatever controller/action combo you want triggered by the empty URL. (The action defaults to "index", so the example above triggers the index action of the welcome controller.) So a typical case might look like: map.connect '''', :controller => "main", :action => "top" or map.connect '''', :controller => "main" # default to "index" action etc. And, like it says, don''t forget to delete public/index.html :-) David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.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 -~----------~----~----~----~------~----~------~--~---
The index.html that is in public is just a place holder. Delete that file and add a route in routes.rb for the "/" path to point to a controller and action you want for the default content. I recommend getting "Agile Web Development with Rails" which starts with a short and to the point tutorial that gets an application up and running, then dives into more detail on each component of an application. Michael On Jun 6, 2:22 pm, Newby <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > I have a very noob question. I just started on RoR this week, glad to be > on board. I''m just wondering where I edit the first page when people > come to the site, index.html. There seems to be one in the public > folder. However, how do I make that a dynamic page? > > Thanks > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---