My code executes fully:
<% for column in ModelName.content_columns %>
|<%= column.human_name %>
<% end %>
but it does not pick up any columns in my model’s table that end in
Is this by design?
Is there a helper method that will reference the related tables? Or
will I need to code the column titles and detail records by hand?
The …_id columns are not “content_columns” according to rails.
They’re used to link to other models.
If you have Company containing many People, the people table will have a
company_id that links back to the company.
In Rails, you’d have the following models:
class Person < ActiveRecord::Base
class Company < ActiveRecord::Base
With that in place, and the correctly named _id field in the people
table, you can do the following:
person = Person.find(:first)
person.company (this is a Company object)
company = Company.find(:first)
company.people (this is an array of Person objects)
You could add person to the company like this:
company.people << person
I recommend you stop typing at this point and read the Agile Web Dev
book before going any further. I promise it’ll be worth it.