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 Build a Simple Ruby on Rails Application Customizing Forms Creating Relationships

Space Cadet
Space Cadet
1,295 Points

"undefined method `statuses' for #<User:0x007fa90645adb0>"

Hey There,

Using rails 4.2.6 and got really confused with the attr_accessor parts of this tutorial.

Tried to trouble shoot it myself by looking at a numbers of threads of this forum, but think I made it worse.

If anyone can point me in the right direction that would be awesome! Repo below.

https://github.com/markcronje/dealshare

Hi Mark,

What is throwing this error - what line number? I'll have a look at that code to see if I can spot the issue.

Steve.

2 Answers

That took me a while to get to your error.

Your methods inside registrations_controller.rb aren't on new lines; I've amended that, so now /users/sign_up works.

I've added a relationship for statuses in the User model and this now works, after a fashion.

I hope that's what you wanted! You should be able to see it in Github.

Steve.

You have a pull request which you can merge into your code.

Space Cadet
Space Cadet
1,295 Points

Thanks so much Steve. Sorry I did'n get back to you earlier. It was late in the evening here in Australia. Will merge your code shortly.

Hi Mark,

Is it line 27 in statuses_controller?

@status = current_user.statuses.new(status_params)

I'll pull the code down and see if I can fix it.

Steve.