Forum: Ruby on Rails How to call database variables from "Public" folder?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E67091aaacd7aaeaef0b05452bb42ae6?d=identicon&s=25 Hao Min (hao922)
on 2006-06-01 10:36
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.
Ed5307c79ba5b415b1ddfee48319099b?d=identicon&s=25 Ioana Kanda (Guest)
on 2006-06-01 10:58
(Received via mailing list)
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.
E67091aaacd7aaeaef0b05452bb42ae6?d=identicon&s=25 Hao Min (hao922)
on 2006-06-01 11:02
Got it.
thank you, Ioana.
This topic is locked and can not be replied to.