I have a Rails 4 application, and the URL localhost:3000/resources.json returns and HTML file, instead of JSON. The index.json.jbuilder is generated by Rails scaffold itself. Any idea why the JSON output is going wrong?
Asked
Active
Viewed 343 times
0
-
Can you post corresponding action and view – techvineet Nov 12 '13 at 07:24
-
Finally, I got the answer. The issue is mentioned in another thread. http://stackoverflow.com/questions/10425064/haml-prevents-template-engines-to-render-anything-else-than-html. I had the application layout named as application.haml. I renamed it to application.html.haml and it works now. – Geordee Naliyath Nov 12 '13 at 07:29
-
nice! Do you have a `respond_to` for json? – Richard Peck Nov 12 '13 at 10:05
-
Yes. I have a respond_to block. I am changing all the files from .haml extension to .html.haml extension. Finding quite a lot of information now (after I asked the question). http://denysonique.blogspot.in/2012/03/rails-views-htmlhaml-vs-haml-htmlerb-vs.html – Geordee Naliyath Nov 12 '13 at 14:15
1 Answers
0
Thought I will answer this question myself based on further searches.

Community
- 1
- 1

Geordee Naliyath
- 1,799
- 17
- 28