OK... after reading the Agile Development book, the new E-Commerce book, parts of the Recipes book, numerous tutorials, screencasts and the like, I was certain that I was ready to begin....
I was wrong.
I have 2 models with a one-to-many relation.
class Photo < ActiveRecord::Base belongs_to :listing # Every photo belongs to a listing end
class Listing < ActiveRecord::Base has_many :photos # Every listing can have numerous photos end
so each listing can have numerous photos, and every photo belongs to a listing. Check.
I created a scaffold for the listing. Great, it shows all the listing data.
My problem is figuring out how to include the Photo data in with the listing data (a join, I think)
** Ultimately, when I look at the detail of a listing, I want to see the listing columns(name, year, etc), and all the photo columns for this listing(paths, image names). **
The generated controller and view code only handles the listing model, but I need it to include the photo model as well.
I know (roughly) how to use mysql commands to get the right columns, but I'm trying to let Rails do it's thing.
Being new, I'm still grasping for which methods are available to me to get the job done.
After programming in another language for a number of years, it's frustrating to know that you want to do something, but don't know enough about the language/framework to make it happen.
Thanks
Matt