I just started the UT on Rails class through reddit and am completely new to programing. I apologize for not being able to articulate my problem clearly. I am watching this video Databases & Rails: Database Backed models with ActiveRecord - YouTube and at 16:18 when the instructor restarts something (terminal) I get completely lost. He consules back into rails after this restart but when I do this I get this:
"User.last.cars
User Load (0.4ms)SELECT “users”.* FROM “users” ORDER BY “users”.“id” DESC LIMIT 1
NoMethodError: undefined method `cars’ for #<User:0x00…"
I apologize again for the poorly asked question but I am really new with all of this.
Thanks for responding to my question. I have completely followed his steps until the restart part. I did notice that when the instructor adds attributes such as :condition and :year that they automatically appear in sublime, but when I check my work in atom the attr_accessible does not appear. Could this be the issue?
Thanks for responding to my question. I have completely followed his steps
until the restart part. I did notice that when the instructor adds
attributes such as :condition and :year that they automatically appear in
sublime, but when I check my work in atom the attr_accessible does not
appear. Could this be the issue?
You did not answer the question as to whether you have added the line
has_many :cars in app/models/user.rb?
As to the issue with attr_accessible, you have to make sure that your
code is the same as the one in the tutorial.
Thanks for replying Colin. I added the “has_many: cars” line in app/models/user.rb just like the instructor. With the attr_accessible part, everything is exactly as it is in the tutorial. I have gone through the project serval times to insure that I am doing everything right and get the same issues every time.