Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in controller class definitions are not surfaced #38060

Closed
frantic opened this issue Dec 21, 2019 · 2 comments
Closed

Errors in controller class definitions are not surfaced #38060

frantic opened this issue Dec 21, 2019 · 2 comments

Comments

@frantic
Copy link

frantic commented Dec 21, 2019

Steps to reproduce

Create a new Rails controller

class IndexController < ApplicationController
  call_to_a_function_that_does_not_exist

  def index
    puts "we are here"
  end
end

and register a route for it

# routes.rb
get "/", to: 'index#index'

Expected behavior

I'd expect to see and error like this in logs or webpage

NameError: undefined local variable or method `call_to_a_function_that_does_not_exist' for IndexController:Class

Actual behavior

If views/index/index.erb.html exists, Rails displays that view (but clearly isn't executing our index method, "we are here" is not in logs). Otherwise it shows an error that says "The action 'index' could not be found for IndexController".

System configuration

Rails version: 6.0.2.1

Ruby version: 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]

@eugeneius
Copy link
Member

This problem was originally reported in #35453 and #37650 and fixed in #37834, but the fix hasn't been released yet.

I've opened #38061 to backport the fix to the 6-0-stable branch.

@frantic
Copy link
Author

frantic commented Dec 21, 2019

Thanks @eugeneius!

@frantic frantic closed this as completed Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants