I am new to Ruby/InstantRails. I am using InstantRails 2.0.2 with mysql
database
My application is named Area, it has two tables: people and country
Table people has two columns: name and tribe
Table country has two columns: location and population
In the models I have:
class People < ActiveRecord::Base
belongs_to :country
end
class Country < ActiveRecord::Base
has_many :peoples
end
I have country_id in the people's table.
I know I can do this:
<% @peoples.each do |people| %>
<td><%= people.name %></td>
<td><%= people.country.location %></td> // This works
What I want to do is to display location on country\index.html.erb
You're confusing Rails with InstantRails. Rails is the web framework,
Instant Rails is a package containing Rails + web server + DB, etc.
Google for Rails books, there are also plenty of suggestions in other
topics in this group. Finally, if you have the time, I would start by
1st learning Ruby and then moving to Rails with AWDR, The Rails Way,
etc.
You are so right Sazima. I am confused like a beginner. Thanks for
clearing that up for me. I have started learning Ruby. Thanks for all
the suggestions guys.