Currently working on a project, and have encountered a problem that I have never come across before. Currently doing a login sign up page that ask the user to sign up. I had a undefined method `name'error before, and then realised that the method is not called name it was called full_name. I have gone through all the folders to ensure that any method or attribute is not called 'name' and renamed it to 'full_name. Having refreshed the browser I recieve the following error which I haven't seen before. Can some please explain what this error is and how possibly I may go about resolving it.
Template is missing
Missing template users/create with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "C:/Users/patterd/Documents/Project/app/views"
This error happens if you don't redirect in the create
method of your controller.
Are you redirecting in the create method in the controller or rendering the new form, in case of error?
Without the redirection in the create method in the controller, you need to make a new file called create.html.erb
. Usually, after successful creation, you redirect to some other page like shown below
def create
# some object you want to create
# if the object.save is fine
# redirect_to object
# else
# render new with the errors
# end
end
In my case I had to process and render no view.
def return_payment
# do lots of stuff
head :ok
end
I had the same problem and the reason was that I left accidentally other empty 'create' method :)
Generally missing template error occurs -when you don't have view file of that method of controller, or -if a method is just for calculation that does not have any view file, then you must have to render/redirect the method.
If you do not render or redirect the method, it will search for the view page of current method name (in your case it will search for create.html.erb).So, you have to render/redirect the method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With