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

Before Filters 7 '<top (required)>' errors

Here's what I got:

I've already added before_filter :authenticate_user!, only: [:new] to status_controller.rb

1) Error:
StatusesControllerTest#test_should_create_status:
NoMethodError: undefined method `before_filter' for main:Object
app/controllers/statuses_controller.rb:2:in `<top (required)>'

2) Error:
StatusesControllerTest#test_should_destroy_status:
NoMethodError: undefined method `before_filter' for main:Object
app/controllers/statuses_controller.rb:2:in `<top (required)>'

3) Error:
StatusesControllerTest#test_should_get_edit:
NoMethodError: undefined method `before_filter' for main:Object
app/controllers/statuses_controller.rb:2:in `<top (required)>'

4) Error:
StatusesControllerTest#test_should_get_index:
NoMethodError: undefined method `before_filter' for main:Object
app/controllers/statuses_controller.rb:2:in `<top (required)>'

5) Error:
StatusesControllerTest#test_should_get_new:
NoMethodError: undefined method `before_filter' for main:Object
app/controllers/statuses_controller.rb:2:in `<top (required)>'

6) Error:
StatusesControllerTest#test_should_show_status:
NoMethodError: undefined method `before_filter' for main:Object
app/controllers/statuses_controller.rb:2:in `<top (required)>'

7) Error:
StatusesControllerTest#test_should_update_status:
NoMethodError: undefined method `before_filter' for main:Object
app/controllers/statuses_controller.rb:2:in `<top (required)>'

7 tests, 0 assertions, 0 failures, 7 errors, 0 skips

1 Answer

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey Wilson Usman are you using Rails 4 by any chance? If so, before_filter was changed to before_action.

Yes I am using rails 4. I just changed it to before_action. Thank you Jason Seifer