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

Method wont define!

Hey everyone,

I am getting a very frustrating "no method define" error when I try to include an .erb tag in my 'status index' page. I cannot understand how the user is STILL undefined if the users "first & last' name is shown correctly on the 'status show' page.

I have read all the documentation i can find regarding strong params and devise on rails 4 so I think i must be missing something simple.

Any help would be much appreciated!

Thanks

2 Answers

Ok I worked it out! (i hope)

I needed to remove the @ in the index page. Everything works well now, however, I don't fully understand why, can anyone help me with this?

What is the significance of the @ in this situation? why is it used in the 'show' page and not in the 'index' page?

Thanks!

the @ symbol is used to indicate an instance variable; this kind of variables can be defined in the controller and they can be accessible from the view.

Without the @ symbol the variable must be defined in the same view.

Look at this video

Awesome thank you!