hao min
2006-Jun-01 08:36 UTC
[Rails] How to call database variables from "Public" folder?
If I want to use for example, <% for product in @products %> in "index.html" (for HomePage) of the "public" folder to call the objects in "products" database table, how do I do that please? It seems that I could not directly call it in the file. actually, I want to partial-render a list for products in the homepage. I think there must be a smart way. btw, is "index.html" the only place we can design homepages? Thx for help. -- Posted via http://www.ruby-forum.com/.
Ioana Kanda
2006-Jun-01 08:56 UTC
[Rails] How to call database variables from "Public" folder?
U shouldn''t work in public folder. Go make your own home_controller with an index method and a view '' index.rhtml''. Go to config/routes.rb and say: map.connect '''', :controller => ''home'', :action => ''index'' (when u access localhost:3000 it will go by default to home/index). Don''t forget to make in the layouts folder the view application.rhtml(that will look similar to public/index.html). I think that is all. On 6/1/06, hao min <mh.pinkoan@gmail.com> wrote:> > If I want to use for example, > <% for product in @products %> > > in "index.html" (for HomePage) of the "public" folder to call the > objects in "products" database table, how do I do that please? > It seems that I could not directly call it in the file. > actually, I want to partial-render a list for products in the homepage. > I think there must be a smart way. > > btw, is "index.html" the only place we can design homepages? > > Thx for help. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cheers, ioana k&a http://boulangerie.wordpress.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060601/8193538d/attachment.html