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 Rails Routes and Resources Routes to Create Actions Controller Action to Create Pages

20,999 Points

Error: Template is missing


def create 
   render text: params.to_json

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


 "page"=>{"title"=>"My bio", "body"=>"Teacher", "slug"=>"bio"},
 "commit"=>"Create Page"}

Why do I get this error?


1 Answer

Jay McGavren
Jay McGavren
Treehouse Teacher

We 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.