Hi
I’m a noob to RoR. I have everything setup but can’t figure out to get
the list display as I would like. I’m sure this is very simple stuff. I
just haven’t figured it out yet 
I hope someone can point me in the right direction 
I have a mysql table “websites”.
In it I have the following columns - Name, Url, Banner, Description
I created “ruby script/generate controller website” (& the model too)
and inserted
model :website
scaffold :website
have not changed the website_controller.rb (well that’s not strictly
true I tried but couldn’t get it to work so reverted back).
Website/list.rhtml is also the default scaffold build.
So I get a nice view of the content of the websites table, however I
want to format this output into something useful.
Something like a looping version of this.
<img src=“Banner” alt"Name" />
Description
It seems the default view grabs everything in one block where as I want
to grab and use the individual columns.
I don’t know enough of the terminology to to a search to find out how to
do such a thing and most of the tutorials I have gone through seem to
display the default scaffold views.
If someone can give me some pointers or even a link to a relevant
tutorial on how to set up such a thing I would be very grateful.
Cheers
Your controller:
def list
@websites = Website.find(:all)
end
Your view (list.html.erb):
<% for website in @websites %>
…stuff for each website here, referencing the column values as
website.column.
<% end %>
On Dec 22, 2007 10:35 PM, Bill G.
[email protected]
wrote:
Cheers
Posted via http://www.ruby-forum.com/.
–
Ryan B.
Feel free to add me to MSN and/or GTalk as this email.
Oh that’s for Rails 2.0, if you’re using it. instead of it being called
list.rhtml it’s now list.html.erb. This is so you can use different
formats
with maintaining an easy to follow naming schema. Nothing you’d have to
worry about. Yet.
On Dec 22, 2007 11:00 PM, Bill G.
[email protected]
wrote:
<% end %>
Posted via http://www.ruby-forum.com/.
–
Posted via http://www.ruby-forum.com/.
–
Ryan B.
Feel free to add me to MSN and/or GTalk as this email.
Nice one - thanks Ryan. I knew it was simple. There is no stopping me
now 
One more question. What is the “.erb” in “(list.html.erb)” below?
Cheers
Ryan B. wrote:
Your controller:
def list
@websites = Website.find(:all)
end
Your view (list.html.erb):
<% for website in @websites %>
…stuff for each website here, referencing the column values as
website.column.
<% end %>
On Dec 22, 2007 10:35 PM, Bill G.
[email protected]
wrote:
Cheers
Posted via http://www.ruby-forum.com/.
–
Ryan B.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.