hi all, I''m very new to RoR and need some help over here. from what i learnt from the tutorials, I understand that it''s very easy to create, update, update, and delete data to and from the DB and load everything to the ''view'' rhtml pages. but now i''m confused when i only want to load a normal home page that will not access any data from the DB. must I create the active record as well? any suggestion is appreciated. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mike Riley
2007-Jun-15 03:31 UTC
Re: How to render normal rhtml page without active record?
fRitZ wrote:> hi all, I''m very new to RoR and need some help over here. > > from what i learnt from the tutorials, I understand that it''s very > easy to create, update, update, and delete data to and from the DB and > load everything to the ''view'' rhtml pages. but now i''m confused when i > only want to load a normal home page that will not access any data > from the DB. must I create the active record as well? > > any suggestion is appreciated.Here is what you can do: If you are trying to do this for your default home page you must do the following: a) delete the index.html page in your public directory, go into your routes.rb file and set up a route to the page you would like the default page to be: Here is what I did: map.connect '''', :controller => "index", :action=>"index" What this means is for the default page redirect the request to the index controller and look for the index method. You will have to set up a index.rhtml page in the view directory called index. If you are just trying to do this for any page: set up a controller (call it whatever you would like). Inside your controller create a method (call it whatever you would like also). Then create a page in your view folder that matches the method name in your controller that you created. Hope this helps. If not, let me know. thanks. Mike -- 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 -~----------~----~----~----~------~----~------~--~---
wow, thx for the reply. i guess it gives me some enlightment. yes, i was referring to some kind of index or home page. i will try it once i reach home. may need further help later on. :) On Jun 15, 11:31 am, Mike Riley <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Here is what you can do: > > If you are trying to do this for your default home page you must do the > following: > a) delete the index.html page in your public directory, go into your > routes.rb file and set up a route to the page you would like the default > page to be: > > Here is what I did: > map.connect '''', :controller => "index", :action=>"index" > > What this means is for the default page redirect the request to the > index controller and look for the index method. You will have to set up > a index.rhtml page in the view directory called index. > > If you are just trying to do this for any page: > set up a controller (call it whatever you would like). Inside your > controller create a method (call it whatever you would like also). Then > create a page in your view folder that matches the method name in your > controller that you created. > > Hope this helps. If not, let me know. > thanks. > Mike > > -- > 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 -~----------~----~----~----~------~----~------~--~---