Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails - Create internal server error (500) at localhost

I couldn't see 500 error when I accessed a URL for which there is no Data, rather it was showing the 'Template missing' error. At the same time, when I ran it at the server, it had shown the 500 error. I need to do testing at local machine. So please tell me how I can create such a situation at localhost?

Thanks & Regards, Rajesh

like image 491
Unni Avatar asked May 25 '26 16:05

Unni


2 Answers

You can create such situation in localhost if you run the server in production mode: rails s -e production (Of course, if the error is still present)

like image 119
Mik Avatar answered May 28 '26 14:05

Mik


If you are getting a template missing error is most probably because you are missing the view file for a given controller action

Ex: if you have a controller called users

class UsersController < ApplicatationController

   def index
   end

end

by default rails is expecting a view in

app/views/users/index.html.erb (or haml)

But if you could post the error log you are getting we might be able to help you more

regards

sameera

like image 30
sameera207 Avatar answered May 28 '26 15:05

sameera207