Hi Cameron and Julian, I guess one of the goals of the book is that you learn by doing. This also includes learning how to interpret the error messages in the browser as well as the logs. Next, you’re being overly sensitive about the book and its content and you need to start checking your work before taking shots at the book in the forum. This is called professional courtesy We, the Rails community, are here to assist you but you need to address this forum in a more tactful manner. Now, where do you stand with this issue?
a) Let’s check the database. Start the MySQL client.
I have already taken a second look at my code, thanks.
Sorry, didn’t mean to sound condescending, We’re trying to help you, please keep that in mind. I wanted to assure you that there’s nothing wrong with the book. The problem you’re having is in your code, or more specifically, in your database.
As you already are probably aware:
img_url does not equal image_url.
Rails auto-generates methods in models based on your table definitions. Since you had no column in your database table called ‘image_url’, you were getting that NoMethodError error.
For future reference, you should avoid using ALTER TABLE / CREATE TABLE statements if you are using Migrations. You can get into trouble there. Migrations issue all of the alter / create statements for you. You really need to choose between the two methods (migration vs managing your own schema). They don’t mix well
I hope everything works out for you. Remember, we’re a helpful bunch, so keep the questions coming.
1)checked the image_url field
2)Rolled back the migration
3) Called the Rake db:migrate again
4) Still getting
rake abort
undefined method `image_URL' for #<Product:0x3d98368>
Why are you using image_URL with capitalized url? Try it with lowercase.