Hello There,
As a newbie, I have followed strictly the steps described in
:http://developer.apple.com/tools/developonrailsleopard.html. Everything
went OK until the “Linking Models Together” part.
I have created the “expenses” structure, but after that I cannot do
anything with it.
I am blocked below :
Start by creating two new vendors in the database:
vendor1 = Vendor.create(:name => ‘Parties R Us’)
=> #<Vendor id: 1, name: “Parties R Us”, …>
vendor2 = Vendor.create(:name => ‘Fire Department’)
=> #<Vendor id: 2, name: “Fire Department”, …>
===> OK for me
Next find an event you created earlier in the web interface:
event = Event.find_by_name(‘Chili Cookoff’)
=> #<Event id: 1, name: “Chili Cookoff”, …>
===> OK for me
Then create two expenses that link the event to each vendor:
event.expenses.create(:vendor => vendor1, :amount => 75.00)
=> #<Expense id: 1, event_id: 1, vendor_id: 1, …>
event.expenses.create(:vendor => vendor2, :amount => 25.00)
=> #<Expense id: 2, event_id: 1, vendor_id: 2, …>
===> No way, I get a message that says that there are no method for
expenses…
Any idea welcome, thanks in advance,
Thierry