I have a database table ''pages'' that is called for the specific pages of the website. Now that I am starting to implement the project I am looking into how I can have a home page that is called everytime just as the home page. Right now I have categories table has_many pages. How can I come up with a solution to having a home page in the database? I was thinking of just creating the home page in the scaffold - then add a column to the table thats titled say index, then have the page I want as the home page to have index set to 1 and not allow scaffolds to change that value for any page. The problem I see with this idea is that to call the information to the main page I would need to set my instance variable with a condition => "index = 1 " or something like that. Well what would happen if a user clicked on a category page? With my idea i do not see how any other information would be called. but I am not sure - of course, I at this point do not know how to pass requests i.e. when a user clicks on a category page, back to the index page for the view to render the new information. any ideas? -- 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 -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller
2008-Mar-07 13:45 UTC
Re: how to declare home page using my current setup
i just implemented something like that. lot''s of pages, one of them the homepage i used a boolean flag column homepage in the table when a new page is set as homepage, i simply set the old one to false: old_homepage = Page.find(:first, :conditions => {:homepage => true}) old_homepage.update_attribute(:homepage, false) if old_homepage when display it: @page = Page.find(:first, :conditions => {:homepage => true}) -- 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 -~----------~----~----~----~------~----~------~--~---