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

Rails server wont load....

Rails server is not starting, I feel like Ruby is trying to put me off at every turn.

The server appears to start like normal then it "exits" with the following error;

Exiting /Users/chickenguts/.rvm/gems/ruby-1.9.3-p484/gems/activemodel-4.0.3/lib/active_model/deprecated_mass_assignment_security.rb:14:in attr_accessible':attr_accessibleis extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or addprotected_attributes` to your Gemfile to use old one. (RuntimeError)

Does anyone have any ideas on how to fix this please ?

Its ironic that all my other learning was leading to here where i can start learning ruby and rails and I can hardly get going on it with all my "ruby issues".....

This is the week where I get back on track !!

2 Answers

So it's seems you are following along with the Treebook videos on here. Now they are using Rails 3.2 and you must be using Rails version 4. In version 4 where in the videos they add the attr_accessible, in Rails 4 this is not the way it is done anymore. You would need to add strong params inside the controller.

    def status_params
      params.require(:status).permit(:content, :user_id)
    end

Something like the above will work for user_name. Then delete the attr_accessible lines you added. A few others bugs will crop up following the videos on the wrong rails version but some research and hair pulling will help you get past them

You can either add protected_attributes gem to the Gemfile (not good in the long run) or learn more about Strong Parameters and write something like Adam suggested above. The only way to be able to use all the code from the videos properly is generating the whole app from scratch using Rails 3 gem, not 4.