Rails控制器即使存在也无法找到我的模板

时间:2014-05-15 22:36:48

标签: ruby-on-rails

def index
  @welcome = current_user.is_Welcome?
  @title = 'Dashboard'
  if current_user.worker?
    project_in_progress = Project.where(:worker_id => current_user.id, :status => 'Currently     Working')
    @projects_in_progress = project_in_progress.order("id DESC").paginate(:page => params[:page], :per_page => 8)
    @bid_invites = current_user.bids.where(:status => 'Invited')
    @project_awarded = @projects_in_progress.where(["updated_at > ?", current_user.last_action])
    @milestone_paid = Milestone.where(:user_id => current_user.id, :status => 'Paid').where(["updated_at > ?", current_user.last_action])
    render :worker_index, :locals => { working_projects: @projects_in_progress, bid_invites: @bid_invites, project_awarded: @project_awarded,
                                       milestone_paid: @milestone_paid, welcome: @welcome }
  elsif current_user.buyer?
    project = current_user.projects.where(:status => ['Hiring Open', 'Currently Working'])
    @open_projects = project.order("id DESC").paginate(:page => params[:page], :per_page => 8)
    render :buyer_index, :locals => { open_projects: @open_projects, welcome: @welcome }
  end   
end

我确实在右侧文件夹中有这些视图。

这是我得到的错误

缺少模板

缺少模板帐户/ buyer_index.html {{locale => [:en],:formats => [:html],:handlers => [:erb,:builder,:arb,:coffee] }。搜索:*“

我真的希望这是我的疏忽......

1 个答案:

答案 0 :(得分:2)

如果您完全确定您的观点是在正确的位置,它们是否恰当地命名?他们需要匹配:handlers=>[:erb, :builder, :arb, :coffee]

中的处理程序

E.g。 app/views/accounts/buyer_index.html.erb