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

Robert Goddard
Robert Goddard
15,019 Points

Building a Simple Ruby on Rails App (Rails 4 + Bootstrap 3)

I've been encountering several inconsistencies between this segment and current technology. This is due to the time this lesson was probably made.

I'm keeping a public repository of me slowly trudging through the inconsistencies and getting as close as possible using Rails 4 instead of 3.2 and Bootstrap 3 instead of whatever bootstrap they are using in the tutorials.

Feel free to follow along on my github. I'm trying to make it as close as possible to the lesson: https://github.com/robthefrog/treebook/commits/master

And if you see something that doesn't work or isn't following good conventions, feel free to comment and make suggestions. I'm pretty new to ruby on rails and web development in general.

7 Answers

I agree that Treehouse should probably push out an update for Rails 4 pretty soon, but their lesson is still very relevant; many apps out there are still on Rails 3 and utilize the Bootstrap 2 framework.

You can still use Bootstrap 2 from here: http://getbootstrap.com/2.3.2/

Or, for a more Railsy approach, you can use the awesome bootstrap-sass gem.

If you want to follow along with Treehouse's lesson exactly, you can set your Bootstrap gem to the specific version:

gem 'bootstrap-sass', '~> 2.3.2.1'

which is shorthand for

gem 'bootstrap-sass', '>= 2.3.2.1', '< 3.0'

which means use any gem version newer than 2.3.2.1 but don’t install 3.0 or anything newer.

Also, if you're just installing Rails, I'd recommend using RVM and specifying that you want to install Rails 3.2.14 rather than Rails 4.

https://rvm.io/

Robert Goddard
Robert Goddard
15,019 Points

I've got RVM installed. I plan to go back through the lesson using rails 3.2 after getting through it with Rails 4. I started with Rails 4 knowing I'd run into issues. I want to run into issues. Let's say I inherit rails 3 code in my job, and they want me to upgrade to rails 4... I'll be ahead of the curve a tad.

Liberty Montano
Liberty Montano
9,003 Points

Thank you! I will check out your github. I started this process a couple of days ago and it is much more painful than I had hoped.

This Railscast was pretty useful (http://railscasts.com/episodes/415-upgrading-to-rails-4). But I did run into a few problems there too. I installed 4.0.0 instead of rc1, I did not include 'gem paper_trail...' line, and I had to remove the 'patch :update_many' line. I am still getting ArgumentErrors - maybe you have all the answers. ;-)

True that

Glenn Harris
Glenn Harris
7,101 Points

I faced the same problem about 6 weeks ago, but I got past it. The tutorial as a whole is very useful despite some inconsistencies. The only major differences I noticed are in the class names used for bootstrap (they changed) and strong params replacing attr accessible.

I actually took a few bootcamps that switched between rails 3 and 4, so I had that experience, but otherwise its mainly a strong_paramaters inconsistency, and some syntax errors.

I got stuck for a long while on the new condition syntax on models, I can't imagine how much work it must take to update all the videos to rails 4 for consistency. I agree it probably would be helpful, but I'd rather just one video update showing what to do for rails 4, or better yet, just new content that relates to rails and keeps me motivated!

Robert Goddard
Robert Goddard
15,019 Points

I finished with the project. If you get stuck trying to use Rails 4 + Bootstrap 3, feel free to clone my repo: https://github.com/robthefrog/treebook

I tried to do a commit after each section.

Jared Galanis
Jared Galanis
8,382 Points

Hey Rob, thank you for providing your repo. I've tested it and it works on my machine perfectly. I too am working through the Build a Simple Rails App tutorial using Rails 4 + Bootstrap 3. I went back through your project files and updated my own wherever I thought it looked appropriate, leaving out some of the later features (given that I'm at an earlier stage of the tutorial). However, I'm still stuck at the Creating Relationships section of the Customizing Forms badge and getting the error "NoMethodError in Statuses#index" and "undefined method `full_name' for nil:NilClass". Did you have to do any additional steps to get this working? Clear the database? Migrate it again? I'm able to signup a user and I can confirm that I'm signed in going to localhost:xxxx/users/edit. If you have the time ever and are willing to look at my repo, I would really appreciate it!!! In any case, I was about to totally give up on this project and my hope is now revitalized given that you've got it working. Thanks! https://github.com/jaredgalanis/treebook