Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 作用域搜索轨道-关键字意外结束输入结束_Ruby On Rails 4_Search - Fatal编程技术网

Ruby on rails 4 作用域搜索轨道-关键字意外结束输入结束

Ruby on rails 4 作用域搜索轨道-关键字意外结束输入结束,ruby-on-rails-4,search,Ruby On Rails 4,Search,我想我不会打开任何功能。。。除了在搜索栏中。。我找不到我不关的地方。。。或者有没有其他我没有提到的参数 这次我已经重启了我的服务器 user.rb class User < ActiveRecord::Base scoped_search on: [:name1, :name2] end 缺少对包含嵌套if语句的if语句的关闭。使用代码格式化程序和适当的缩进确实有助于查找缺少的结束标记。我在下面添加了缺少的结束标记 <% if @users.nil? %> Pleas

我想我不会打开任何功能。。。除了在搜索栏中。。我找不到我不关的地方。。。或者有没有其他我没有提到的参数

这次我已经重启了我的服务器

user.rb

class User < ActiveRecord::Base
  scoped_search on: [:name1, :name2]
end

缺少对包含嵌套if语句的if语句的关闭。使用代码格式化程序和适当的缩进确实有助于查找缺少的结束标记。我在下面添加了缺少的结束标记

<% if @users.nil? %>
  Please enter your search
<% else %>
  <% if @users.size == 0 %>
    Could not be found
  <% else %>
    there are <%= pluralize(@users.total_entries,"user")%></strong> on <strong>"<%=params[:q] %>"</strong> <%render @users%>
  <% end %>
<% end %>
因此,您可以从第23行附近的erb文件开始查找。

您的最佳花花公子THX~~(>)。
class UsersController < InheritedResources::Base
layout 'guest'
  def search
    @users = User.paginate( :page => params[:page], :per_page => 9 )
    flash[:notice] = " "
  end
 end
app/views/users/search.html.erb:23: syntax error, unexpected keyword_ensure, expecting keyword_end
app/views/users/search.html.erb:25: syntax error, unexpected end-of-input, expecting keyword_end
<% if @users.nil? %>
  Please enter your search
<% else %>
  <% if @users.size == 0 %>
    Could not be found
  <% else %>
    there are <%= pluralize(@users.total_entries,"user")%></strong> on <strong>"<%=params[:q] %>"</strong> <%render @users%>
  <% end %>
<% end %>
app/views/users/search.html.erb:23: syntax error, unexpected keyword_ensure, expecting keyword_end