Unni
Unni

Reputation: 165

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

Upvotes: 3

Views: 2907

Answers (3)

Ricketyship
Ricketyship

Reputation: 654

It's a simple problem with your corresponding view not being present. Open the control file which corresponds to your url. Then see the action which is being called and then, see if the corresponding view is available in the app/views/ folder.

The reason for 500 error is the same 500 says that there was an internal error at the server side.

Also, don't go about changing the url's charecter and stuff. IT WONT WORK!

Upvotes: 1

Mik
Mik

Reputation: 4187

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)

Upvotes: 3

sameera207
sameera207

Reputation: 16629

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

Upvotes: 1

Related Questions