Im very much a newbie to ruby, and am stuck with what is probably a very simple fix...
I am creating a system that creates html pages, which a client can download.
So, I have one project, that has many details, meta tags, images etc. Each one of these has its own model, and db table, and they are all setup with has_many (Project) and belongs_to (details, meta tags, images etc) relationships.
This all worked fine, create, show, edit etc until the database id fields on the tables went out of sync during working on the validations.
So I added in the project_id column on the tables as a backup plan so they are not all running off the id column that auto increments...
Now, when I click 'show' on my project, I get the error: Couldn't find Image with ID=43, and thats because there is no image with the id on the table as it went out of sync.
So how do I make it so that when I click 'show', it gets the project_id of the image instead of the id?
Hope that makes sense? It may not be the best way of doing it, and im still learning, so any suggestions are welcomed.
Not really. Maybe it's just the lateness of the hour but I'm having trouble envisioning it. (maybe it's just the concept of a project belonging to a meta tag that's bugging me.)
Seriously, if your ids are "out of sync" then I'd either pull out a database editor and get them back into sync, or wipe them all out and start over. The worst thing in the world is to suddenly create a new column and try to switch over to using that. Since we're just talking development, I'd think it was simpler to just go "Oops" and start over.
Bookmarks