Let me first say, I’m really enjoying the book so far. I have been trying to go through the examples with writing the code myself to make sure I’m getting the concepts. I understand everything you are talking about in section 6.4; but trying to run the code in this section was a big leap in some missing code examples somewhere.
I ran this command and got an error that says find_by_number is an undefined method.
f = Flight.find_by_number ‘123’
Ok, so I could code this myself at this point I suppose. But my bigger question is how did the reservation table ever get created in the database. I ran the command ‘ruby script\generate resource reservation’ to get the files created. Then ran a ‘rake db:migrate’. But it seems that create the reservation table with an id column instead of with flight_id and passenger_id columns. How does the table reservation get created in the database so the code in section 6.4 will work correctly?