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 trialvaleriuv
20,999 PointsError: Template is missing
After
def create
render text: params.to_json
end
it gives the error:
Missing template pages/create, application/create with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in: * "/Users/username/Sites/ruby/blog/app/views"
It looks like this is an error saying that I don't have the create.html.erb view, right?
However, it still shows me the json under
Request
{"utf8"=>"✓",
"authenticity_token"=>"dF6N6op8uGNwBcqlUtDYoxUtZwlEE86XRf0Vt4zdmzozK4nb3ctTouC4QSKhs5zgJnSXMBYIXJYvKTbrRt/Q9g==",
"page"=>{"title"=>"My bio", "body"=>"Teacher", "slug"=>"bio"},
"commit"=>"Create Page"}
Why do I get this error?
Thanks!
1 Answer
Jay McGavren
Treehouse TeacherWe recommend installing Rails 5.0 to use with this course. With Rails 5.1 and later, render text:
no longer works, but if you change it to render plain:
, that should work correctly.