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

Help again on Ruby on Rails project :(

Preface by saying I am running the most up to date version of rails and ruby so this may be the cause of the error, but I would hope someone could help me correct it.

The error is saying I dont have full_name method defined, even though my screenshot will show otherwise. I will attach a bunch of screens for reference, and I am stumped what I did wrong.

chris salvi test tagging

OK, just start typing the @ symbol and then my name and a dropdown should appear, select me and that part will become a link when you post the question/comment. I will probably get notified if tagged.

3 Answers

Seems like Strong Parameters problem. When you create a new user through the page form and go to Rails Console, does that user have the first name and last name, or are they nil?

Hi Maciej,

Thank you for all your help this past week. I will check and get back to you. Im not sure why these strong parameters would be an issue since I've followed the video to a T, but then again Im running a much newer version of ruby and rails and havent checked about all the depreciated syntax.

The videos use Rails 3. Rails 4 introduces Strong Parameters by default, so it's a very common problem with this course.

ugh, I respect the output of videos on this site, but they could really use some better documentation on the lessons if things are outdated for newer versions. Just write up a few paragraphs in the teachers notes.

Also, keep posted. I wont be able to run my program until later, so I will see what's up then

Here's one suggested workaround, first try Tanner's method, then you can scroll down to see my solution, both should work:

https://teamtreehouse.com/forum/attraccessible-missing-in-rails-4-heres-the-workaround-for-the-treebook-tutorial

Maciej, do you mind taking a look at the project from my github account? I am still receiving an error when I press the create status button despite following the rails 4.0 tutorial.

https://github.com/donsalvadori

Sure, I'll take a look and let you know.

thank you so much. It's a community with people like you that make this site worth it.

I can't find anything wrong...the application runs smoothly. I can register, publish posts and everything shows up. No errors when registering or posting.

What I can suggest, maybe it will work:

Create a new folder, download your app from github (either clone or download a zip), run bundle install`` just in case, runrake db:migrate, runrails s``` and go to localhost 3000. See if the problem persists. The copy from your github works perfectly on my Linux and J Scott Erickson's machine. We will try to investigate further if this doesn't work. Sorry for the delay.

thanks maciej, I had a friend debug it for me over the weekend, and Im still a tad unsure of the changes he made, but the code up on github is now error free, although I need to clean up the styling a tad since Im using a different version of bootstrap. Hopefully I can rely upon you in the future if I need help. Is there a way to tag users on here for questions?

Sure you can :). I have no idea if tagging is possible. Just post your question, I will see it sooner or later ;)

Try this. I think it'll work, but I'm not 100:

# inside the User class

def full_name
    self.first_name + " " + self.last_name
end

so self looks up to the User class/object? Sort of like how this does in javascript? I dont really see the necessity for this, but then again Im just getting used to the language. I will try your suggestion in a bit and confirm if it works.

Exactly! All object-oriented languages have that construct or something similar. Everything from JavaScript to PHP to Objective-C to Java.

unfortunately that did not work Ryan, but there must be something wrong with how it's reading the index.html.erb file because when I delete .full_name everything works again.

also now getting this error when I click on 'post a new status'

http://postimg.org/image/yyvby12qn/

This issue must be fixed? I cloned your project from github and couldn't find an issue ( other than in your statuses controller the strong params were on the same line as the method definitions ), but it works for me otherwise.

J Scott, as of now I get an error when I

  1. click on the create status button
  2. click on register