我在我的测试应用程序中添加了Design4.0(这是一种灵活的身份验证解决方案),它运行得非常好。但是,当我在索引视图中编写更新概要文件的选项时。我得到了以下错误:
缺少模板配置文件/更新,应用程序/更新与{:locale=>:en,:formats=>:html,:variants=>[],:handlers=>:erb,:builder,:raw,:ruby,:jbuilder}。搜索:* "/Users/jalanya/Documents/dev/ruby/twitter-clone/app/views“* "/Users/jalanya/.rvm/gems/ruby-2.2.2/gems/devise-4.0.0/app/views”
现在,我只有一个名为"index.html.erb“的文件夹视图/配置文件下面的视图。那么,我的问题是,是否应该为操作"profile#update“添加另一个视图模板?如果是的话,我怎样才能做到呢?
我有我的测试应用程序在github,如果你想测试以及。请在下面找到我到目前为止拥有的文件。
routes.rb
Rails.application.routes.draw do
get 'profile' => 'profile#index'
post 'profile' => 'profile#update'
devise_for :users
root 'home#index'
endprofile_controller.rb
class ProfileController < ApplicationController
before_action :authenticate_user!
def index
end
def update
end
endviews/profile/index.html.erb
<h2>Update profile</h2>
<%= form_tag "/profile" do %>
<div class="row">
<form class="col s12">
<div class="row">
<div class="input-field col s6">
<input name="first_name" id="first_name" type="text" class="validate">
<label for="first_name">First Name</label>
</div>
<div class="input-field col s6">
<input name="last_name" id="last_name" type="text" class="validate">
<label for="last_name">Last Name</label>
</div>
</div>
<div class="row">
<button type="submit" class="btn right">Save</button>
</div>
</form>
</div>
<% end %>请告诉我你的反馈。
发布于 2016-04-24 04:32:29
您需要在路由文件中添加更新视图或注释掉该行。现在,您正在告诉路由关于一个不存在的视图。
要添加它,您可以输入"rails生成视图“或手动进行。
https://stackoverflow.com/questions/36817079
复制相似问题