Topic: Including Associations in List action
I'm very new to Rails, though I've had lots of experiencing developing MVC apps with PHP (smarty) and Java (spring/hibernate). I'm still trying to get my head around some of the framework vagaries. I'm having trouble understanding exactly how associations get passed around in the MVC framework. For example, I'm writing an app to manage survey replies. One of the columns in my "replies" table is country_id, indicating a numerical representation of the respondee's country that matches up with "id" in the "countries" table. The countries table contains id, the name of the country and the name of the region of that country. Obviously, many different replies could contain the same country_id. So, for my models:
class Reply < ActiveRecord::Base
class Country < ActiveRecord::Base
I believe this would be the correct relationship. The first thing I notice is that if I generate scaffold for Reply, it does not display the field country_id for action "list". Does rails automatically treat fields with "_id" differently?
Secondly, I would like to know what I have to override to display the country name from the countries table and not the country_id from the replies table.
Thanks in advance!