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.
Also, how would I reference the object if it was contained in an expense object like this:
class Expense < ActiveRecord::Base
belongs_to :expense_type
end
would it be:
expense.expense_type
or
expense.expensetype
Cheers