How to set up my belongs_to and has_many reference
- by dagda1
Hi,
I have an ExpenseType object that I have created with the following migration:
class CreateExpenseTypes < ActiveRecord::Migration
def self.up
create_table :expense_types do |t|
t.column :name, :string, :null => false
t.timestamps
end
end
I can see the table name is the pluralised expense_types. My question is, how do I reference this type in a belongs_to relationship?
Is it:
belongs_to :expensetype
or is it
belongs_to :expense_type
I do not seem able to set it up correctly.
Cheers