我是Ruby的新手,在單擊應用程序中的一個鏈接時會出現以下錯誤,該鏈接應呈現用於創建用戶配置文件的表單。我非常感謝任何幫助。在Ruby中獲取缺少的模板錯誤
缺少具有{:locale => [:en],:formats => [:html],:variants => [:,handlers => [:erb, :builder,:raw,:ruby,:jbuilder,:coffee]}。搜索:*「/ home/ubuntu/workspace/app/views」*「/usr/local/rvm/gems/ruby-2.3.0/gems/devise-3.4.1/app/views」
模型/ profile.rb
class Profile < ActiveRecord::Base
belongs_to :user
end
控制器/ profiles_controller.rb
class ProfilesController < ApplicationController
def new
# form where a user can fill out their own profile.
@user = User.find(params[:user_id])
@profile = @user.build_profile
end
end
應用/視圖/簡檔/ new.html.erb
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h1 class="text-center">Create Your Profile</h1>
<p class="text-center">Be a part of the Dev Match community and fill out your profile!</p>
<div class="well">
<%= form_for @profile, url: user_profile_path do |f| %>
<div class="form-group">
<%= f.label :first_name %>
<%= f.text_field :first_name, class: 'form-control' %>
</div>
<div class="form-group">
<%= f.label :last_name %>
<%= f.text_field :last_name, class: 'form-control' %>
</div>
<div class="form-group">
<%= f.label :job_title %>
<%= f.select :job_title, ['Developer', 'Entrepreneur', 'Investor'], {}, class: 'form-control' %>
</div>
<div class="form-group">
<%= f.label :phone_number %>
<%= f.text_field :phone_number, class: 'form-control' %>
</div>
<div class="form-group">
<%= f.label :contact_email %>
<%= f.text_field :contact_email, class: 'form-control' %>
</div>
<div class="form-group">
<%= f.label :description %>
<%= f.text_area :description, class: 'form-control' %>
</div>
<div class="form-group">
<%= f.submit "Update Profile", class: 'btn btn-primary' %>
</div>
<% end %>
</div>
配置/區域設置/ routes.rb中
Rails.application.routes.draw do
devise_for :users, controllers: { registrations: 'users/registrations' }
resources :users do
resource :profile
end
resources :contacts
get '/about' => 'pages#about'
root 'pages#home'
end
看起來錯誤是來自設計?如果是這樣,你需要按照自述文件中關於如何正確設置設計的設計寶石。 – trueinViso
顯示您的路線,請 –
對不起。路線添加。 @trueinViso:這是因爲設計? –