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

Report of errors in JBuilder partials is totally wrong #6037

Closed
Sephi-Chan opened this issue Apr 28, 2012 · 1 comment
Closed

Report of errors in JBuilder partials is totally wrong #6037

Sephi-Chan opened this issue Apr 28, 2012 · 1 comment

Comments

@Sephi-Chan
Copy link
Contributor

Hi,

I noticed two errors in the reporting of errors with jbuilder partials rendered from a view.
The first is weird but not a big deal, the second is really problematic for debugging.

I have a view and two partials.

In views/application/home.html.haml, I have:

- json = render(partial: 'users/user', formats: [:json], locals: { user: @user })
= javascript_tag { "window.data = {}; window.data = #{raw(json)};" }

In views/users/_user.html.haml, I have:

= user.undefined_method_called_from_haml_template

In views/users/_user.json.jbuilder, I have:

json.name user.undefined_method_called_from_jbuilder_template

Displaying the page raises:

NoMethodError in Application#home
Showing ~/MyTest/app/views/users/_user.html.haml where line # raised:
undefined method `undefined_method_called_from_jbuilder_template' for #User:0x007fb2bea96de8

The reported file is wrong: it should be the JSON version.

So now, the second error is visible when there is no other version of the same partial (in my case, by removing _user.html.haml).

ActionView::MissingTemplate in Application#data
Showing ~/MyTest/app/views/application/home.html.haml where line #1 raised:
Missing partial users/user with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :jbuilder, :coffee, :haml]}.

What the hell? Why does any errors occurring in the partial are ignored and reported as a missing template (plus, the formats and handlers are not correct?
If I fix the error (not easy with this weird report) in the template, it works!

Any idea?

@vijaydev
Copy link
Member

Please raise it in the jbuilder issues tracker. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants