I’m trying to use a create.js.erb templete, located in /app/views/users/
but I get the following error:
Template is missing
Missing template users/create, application/create with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "/home/tim/fairym/app/views"
My controller action, I base it on the following railscast:
http://railscasts.com/episodes/381-jquery-file-upload
def create
@user = User.create(params[:user])
end
What is the problem here?
The reason why it cannot find your template is because, if you notice on the railscast episode, he is doing an AJAX request for a datatype of
scriptSo depending on how you are doing your link to the create action that link probably expects a html format to be rendered.
You can fix this by adding a
render jsto your action or if you are doing an ajax request make sure your datatype is set to script.