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

My implementation of treebook (rails 4, bootstrap 3, etc)

Hey guys. Just thought I'd share my own implementation of treebook to help others. https://github.com/morenoh149/treebook

I went through the trouble of making it work on rails 4 and added notes for things I had to do differently. This can help other students. And helps the professors update their lessons.

cheers!

3 Answers

Thanks for sharing, I've starred it for later reference.

Hi Harry,

I'm building this in Rails 4 as well and having a few small issues.

undefined method `user_id' for #<SimpleForm::FormBuilder:0x007fa8025bfcf0>

<%= f.user_id %> is blowing up my app. Any ideas? Im in the "customizing forms" section.

https://github.com/morenoh149/treebook/blob/master/app/views/statuses/_form.html.erb I see it's

<%= f.input :user_id, collection: User.all, label_method: :full_name %>

but for you maybe it should be

<%= f.input :user_id %>

'f' in this context is the form for the @status object. You're making an input 'f.input' that will submit to the 'user_id' property of @status.

Hi Harry! I've looked at your code and try to do as you have. But I stuck with a problem, I always get the error message = "undefined method `full_name' for nil:NilClass" It's the same for first name, last name and profile_name.

Do you know what my problem is?

your user class is nil. Probably because you haven't created one yet. Add a validation to your show action so you are forced to be logged in first before calling those methods. Read through my implementation, or keep working through the videos and changing things little by little. That's what I did.