[英]Rails 5 partial only rendering within certain views
Hi I have a partial that holds a button. 嗨,我有一个持有按钮的局部。 I have some business logic written around the button so that it becomes active/inactive for certain users etc..
我在按钮周围编写了一些业务逻辑,以便某些用户等可以使用它。
I have rendered this partial successfully in one view but I have added again in two other places and I get this error: 我已经在一个视图中成功渲染了该部分视图,但是在另外两个地方又添加了一个错误:
Missing partial app/views/borrowers/shared/_create_campaign_button.html.erb with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in:
* "/home/donal/Desktop/flenderProject/flender/app/views"
* "/home/donal/.rvm/gems/ruby-2.3.1/gems/kaminari-core-1.0.1/app/views"
* "/home/donal/.rvm/gems/ruby-2.3.1/gems/devise-4.2.0/app/views"
Extracted source (around line #11):
9
10
11
12
13
14
<% if @user.present? #if @user.is_irish? && @user.is_business? %>
<%= render 'app/views/borrowers/shared/create_campaign_button.html.erb' %>
<% end %>
<ul>
Rails.root: /home/donal/Desktop/flenderProject/flender
Application Trace | Framework Trace | Full Trace
app/views/campaigns/index.html.erb:11:in `_app_views_campaigns_index_html_erb__4376944130783067979_70279893678640'
app/controllers/campaigns_controller.rb:64:in `index'
Request
Parameters:
None
Replace this: 替换为:
<%= render 'app/views/borrowers/shared/create_campaign_button.html.erb' %>
with 同
<%= render 'borrowers/shared/create_campaign_button' %>
It is searching for the partial in app/views , so you don't need to add it to the file path. 它正在app / views中搜索partial,因此您无需将其添加到文件路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.