【发布时间】:2016-04-23 22:16:00
【问题描述】:
我在我的测试应用中添加了 Devise 4.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/应用程序/视图”
目前,我只有一个名为“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'
end
profile_controller.rb
class ProfileController < ApplicationController
before_action :authenticate_user!
def index
end
def update
end
end
views/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 %>
请让我知道您的反馈。
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-4 reactjs devise webpack