Hi -- I''m very new to rails. I have a couple of what have to be very naive questions. I don''t know what else to do but to ask them. I will use separate posts. The default page is public/index.html. Presumable this would be what one would use as a home page. I don''t understand why it''s setup as an html page (rather than an rhtml page). I would think that it would be a common requirement to have embedded ruby code in the home page. Presumably I''m either missing something or there is an easy work around. Could someone please square me away? Thanks. ... doug --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Doug,> The default page is public/index.html. Presumable this > would be what one would use as a home page. I don''t > understand why it''s setup as an html page (rather than > an rhtml page). I would think that it would be a common > requirement to have embedded ruby code in the home > page.Only pages within the application space get processed via Rails and thus have their eRb processed into html. The /public directory in which all browsers look for index.html is not within the Rails application space. You can override this. Tom Fakes posted the following recently in response to a similar query.> I usually have a controller I call ''main'', with an action called > ''index'' for my home page. Then I have a named route: > > map.home ''/'', :controller => ''main'', :action => ''index'' > > I can add my About, Terms and Conditions, and other random > pages that don''t fit anywhere else in the main controller.hth, Bill --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Everything under the public directory such as static html pages, images, javascripts and stylesheets will be served up to the browser by the webserver. It is there as a static file so that you can verify that you have installed everything properly on your machine. When you run the script/server on your machine, you will see the Welcome aboard, You are riding on Rails welcome screen. You can click on the environment setup which uses AJAX calls to show details about your environment. My environment setup looks like this: Ruby version1.8.5 (powerpc-darwin8.8.0)RubyGems version0.9.2Rails version 1.2.2Active Record version1.15.2Action Pack version1.13.2Action Web Service version1.2.2Action Mailer version1.3.2Active Support version1.4.1Application root/Users/balaparanj/work/my_appEnvironmentdevelopmentDatabase adaptermysql On 3/10/07, doug <ddjolley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > uld think that it would be a common > requirement to have embedded ruby code in the home > page. Presumably I''m either missing something or there > is an easy work around. Could someone please square > me away? Thanks. > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
doug wrote:> Hi -- > > I''m very new to rails. I have a couple of what have to be > very naive questions. I don''t know what else to do but to > ask them. I will use separate posts. > > The default page is public/index.html. Presumable this > would be what one would use as a home page. I don''t > understand why it''s setup as an html page (rather than > an rhtml page). I would think that it would be a common > requirement to have embedded ruby code in the home > page. Presumably I''m either missing something or there > is an easy work around. Could someone please square > me away? Thanks.To render an .rhtml page requires the presense of a controller and a default "/" route pointing to that controller, neither of which are present when you run "rails <myapp>". That is why it''s a static HTML page. -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> > I usually have a controller I call ''main'', with an action called > > ''index'' for my home page. Then I have a named route: > > > map.home ''/'', :controller => ''main'', :action => ''index''Works great. They also have an example of how to do it using a regular route (as opposed to a named route) in routes.rb. In both cases one has to remember to trash public/index.html for the routing to work. Thanks for the input. ... doug --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---