Ruby on Rails
Sunday, January 7, 2018
render text: is deprecated. Stick with render plain: .
Phil
On Jan 7, 2018, at 2:12 PM, Robert Phillips <robert.phillips37@gmail.com> wrote:It works fine as far as thisC:\blah>rails new test1C:\blah\test1>rails serverI edit application_controller.rbI add a function called hellodef hellorender plain: "aasdf"endI edit the routes.rb fileI add this line into the existing procedure within routes.rb root 'application#hello'I access 127.0.0.1:3000/ and it shows aasdfSo that's all fineBut here's the problemIf I edit application_controller.rb and change that line from render plain: "aasdf" into render text: "hello world!" then it doesn't work. Though https://www.railstutorial.org/book/static_pages suggests using render text: "hello world!". in the application controller hello procedure.i.e.def hellorender text: "hello world!"endI get the error "Missing template application/hello with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in: * "C:/blah/test1/app/views""
And if I change it to one suggestion regarding that kind of error, that I saw online, the suggesetion is to add a parameter of content_type: 'text/plain' i.e.def hellorender text: "hello world!", content_type: 'text/plain'endThen I get the same errorWhere am I going wrong here?Thanks--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/eb8a4956-0925-4085-aefc-cb13eedecd0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment