Ruby on rails 我有一个循环在RubyonRails上不起作用

Ruby on rails 我有一个循环在RubyonRails上不起作用,ruby-on-rails,Ruby On Rails,我有一个循环,检查是否没有图像显示一个虚拟图像。我不知道这个循环有什么问题。这不是显示虚拟图像。任何帮助将不胜感激。多谢各位 .col-md-12 - @applied_users.each do |user| .applied %a %a.litle-modules.pull-left{href: show_user_public_path(user.id, ((Apply.where user_id: user.id, job_id: @job.id).f

我有一个循环,检查是否没有图像显示一个虚拟图像。我不知道这个循环有什么问题。这不是显示虚拟图像。任何帮助将不胜感激。多谢各位

 .col-md-12
  - @applied_users.each do |user|
    .applied 
    %a
      %a.litle-modules.pull-left{href: show_user_public_path(user.id, ((Apply.where user_id: user.id, job_id: @job.id).first).id)}
        .col-xs-6.col-md-5
          .thumbnail
            - if user.image != nil
              = image_tag "profile_pic.jpeg"
            - elsif user.image.nil?
              = image_tag "profile_pic.jpeg"
        .col-md-7.pull-right
          %h2= user.fname
          %p= user.location
          %p= user.description

def show_private
        #this method is responsible for showing the companies their job application page after matches have been made and after people have applied. 
        neo_results_array = []
        percentage_match = []
        @job = Job.find(params[:id])
        @neo_results = Neo4jProcess.match_users(@job.id, 20000)

        filtered_results = JSON.parse(@neo_results)
        users = filtered_results["users"]
        users.each do |user|
            if user["score"] >= 0.005
                neo_results_array << user["user_id"]
                percentage_match << user["score"]
            else
            end
        end
        @final_array = neo_results_array.zip(percentage_match)
        print @final_array

        if @job.applies == [] && neo_results_array == []
            redirect_to share_page_path(@job.id)
        else @job.applies != [] || neo_results_array != []
            applied = @job.applies.pluck(:user_id)
            @applied_users = User.find(applied) 
            percentage_user_array = []

            @final_array.each do |item|
                percentage_user_array << item[0] 
            end
            @matched_users = User.find(percentage_user_array)
      end   
    end

刚刚编辑。在这里,您可以看到我的控制器负责img和其他事情

从其他设备中删除条件

如果你想为其他人设置一些条件,也可以使用

 elsif user.image.nil?

您确定user.image为零吗?请立即尝试。编辑了答案。你看不到任何错误,对吗?不,我看不到任何错误。你刚才编辑的内容也不起作用。您认为控制器中可能存在错误吗?发布控制器操作和整个视图文件。至少循环。如果它没有拾取图像,请尝试调试,方法是用一些文本替换图像标记。我们将了解它是循环问题还是图像问题