Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

ActiveRecord::RecordNotFound: Couldn't find Status with id=

When I try to run the functional test for status controller i get this error 5 times, what can I do to fix it. ActiveRecord::RecordNotFound: Couldn't find Status with id=980190962 [WHERE "statuses"."user_id" = 625417172], these test are made in Join Table video.

Thank you

7 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hi Alex,

Try making sure that you are sending in the correct status to the test and that it belongs to the correct user in the fixtures file. That would seem to be the problem.

Projects.yml one: name: alex description: MyAddress2 url: MyString2 two: name: alex description: MyAddress url: MyString three: name: ben description: "My Address1" url: MyString

when I modify the method update in this controller to:

@project = current_user.projects.find(params[:id]) if params[:project] && params[:project].has_key?(:user_id) params[:project].delete(:user_id)

I get the error messages that I posted before, but if i leave the update method with its default values I get: test "should not update the project if nothing has changed" do sign_in users(:alex) put :update, id: @project assert_redirected_to project_path(assigns(:project)) assert_equal assigns(:project).user_id, users(:alex).id end

I did exactly like you Jason, or maybe I forgot to add somethings, but I can not find what or where. Or maybe the fixture, because I don't have the field that row called user?

Thank you for your time Jason

Jason Seifer
Jason Seifer
Treehouse Guest Teacher

That's correct, you'll need the user row for the object to be associated via fixtures. That would probably be the cause of the failures.

I changed 2 things I added user, and I checked my test setup, because I forgot to add users to sign_in :) thank you for your help

Nobody knows anything?:(

Jason, are there any tools for catching the errors? or what other solution I have? Because the app is working fine, only the tests have problems and I want to fix them, because I do not need any surprises later.

Regards, Alex

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey Alex Alex unfortunately it just takes time to figure out what the error messages mean. Once you get good at that, debugging will be a lot easier. Are you still getting errors?

No, i fixed them all and finished Building Social Features in Ruby on Rails tutorial, but I have problems with the challenges, every time I press the check work it gives me an alert, and I am sure that what I am writing them right.

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

What challenges are you having trouble with?

Code Challenge: Controller Formats, Code Challenge: Adding States, Code Challenge: Adding Controller Methods, Code Challenge: Scoped Finders, Code Challenge: Creating Model Methods.

It takes a lot of time to compile them, and after that it tells me to contact treehouse.