2017-02-17 1 views
0

.csv 파일을 가져 오려고하면 다음 오류 메시지가 나타납니다.openproject에서 .csv 파일 가져 오기

NoMethodError in Users1#index 
undefined method `project' for #<AnonymousUser:0x00000005737b98> 

MY users1_controller.rb

class Users1Controller < ApplicationController 
    def index 
    @users1 = User.all 
    end 

    def import 
    User.import(params[:file]) 
    redirect_to root_url, notice: "Activity Data imported!" 
    end 
end 

MY index.html.erb

<h1>Users1#index</h1> 
<p>Find me in app/views/users1/index.html.erb</p> 
<%= flash[:notice] %> 
<table> 
<thead> 
<tr> 
<th>Projects</th> 
<th>Task ID</th> 
<th>Tasks</th> 
</tr> 
</thead> 
<tbody> 
<% @users1.each do |user| %> 
<tr> 
<td><%= user.project %></td> 
<td><%= user.task_id %></td> 
<td><%= user.task %></td> 
</tr> 
<% end %> 
</tbody> 
</table> 
<div> 

<h4>Import that data!</h4> 
<%= form_tag import_users_path, multipart: true do %> 
<%= file_field_tag :file %> 
<%= submit_tag "Import CSV" %> 
<% end %> 
</div> 

답변

0
난 당신이 사용자 및 AnonymousUser에 대해 하나의 테이블을 사용하고 있는지 물어 시작할 것

. 익명 사용자가 :project에 응답합니까?