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

ActionController::ParameterMissing: param not found: status

If you're building treebook in the currently unsupported (to this tutorial), rails 4. You may come across this error at the end of the in the Join Table video. Specifically the "should not update the status if nothing has changed" test in statuses_controller_test.rb.

 1) Error:
StatusesControllerTest#test_should_not_update_the_status_if_nothing_has_changed:
ActionController::ParameterMissing: param not found: status
app/controllers/statuses_controller.rb:82:in `status_params'
app/controllers/statuses_controller.rb:54:in `block in update'
app/controllers/statuses_controller.rb:53:in `update'
test/controllers/statuses_controller_test.rb:94:in `block in             <class:StatusesControllerTest>' 

I believe this has to do with a change to the rails require behavior mentioned here, that returns a 400 error when the value for the required key is empty.

Anyone else run into this?

3 Answers

My workaround

def status_params
  params.require(:status).permit(:name, :content, :user_id) if params[:status]
end

That did the trick... thanks Brijesh!

Hmmm...but now when I do this I get:

1) Error: StatusesControllerTest#test_should_not_update_the_status_if_nothing_has_changed: ArgumentError: When assigning attributes, you must pass a hash as an argument. app/controllers/statuses_controller.rb:51:in `block in update' app/controllers/statuses_controller.rb:50:in `update' test/controllers/statuses_controller_test.rb:89:in `block in <class:StatusesControllerTest>'

Anyone else see this?

Thanks! That helped!

Thank you, Brijesh!!

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey Daniel Terreros sorry for the trouble! We'll be coming out with Rails 4 videos as soon as we can. In the mean time, you can use Rails 3.2.13 to follow along with the videos.

I'm having fun running into and trying to fix these errors, but thank you for responding!

Jason Seifer
Jason Seifer
Treehouse Guest Teacher

Cheers! Check out the documentation on strong parameters for tips :)

Jason Seifer it would be awesome if you guys could post a 'solved' version of Treebook using Rails 4 for us to tutor ourselves on how to work through these challenges.

Maybe take a completed Rails 3 version and refactor with notes?? That would be amazing!

Thank you