2017-07-03 45 views
-2

我想表明從員工考勤表,該表是白天和現在的兩列,但無法顯示 -如何從ror中的控制器傳遞參數?

這裏是我的節目頁面 -

<div class="box box-default"> 
<div class="box-header with-border"> 
<h3 class="box-title">Holiday Setup</h3> 
</div><!-- /.box-header --> 
<div class="box-body"> 
<table id="example1" class="table table-bordered table-hover table-condensed"> 
    <thead> 
    <tr> 
     <th>Day</th> 
     <th>Present</th> 
    </tr> 
    </thead> 
    <tbody> 
    <% @employee_attendances.each do |employee_attendance| %> 
     <tr> 
      <td><%= employee_attendance.day %></td> 
      <td><%= employee_attendance.present %></td> 
     </tr> 
    <% end %> 
    </tbody> 
</table> 
</div> 
</div> 

控制器代碼 -

def holiday_setup 
    @day = params[:day] 
    @employee_attendances = EmployeeAttendance.where(present: 'H',day: @day) 
end 
+0

*但無法顯示*你會得到有什麼錯誤? – Pavan

+0

沒有..但是當我調試一天給零。 –

+0

'params [:day]''裏有什麼嗎? –

回答

0

錯誤解決我取代了從@employee_attendances = EmployeeAttendance.where(現在:'H')現在顯示數據查詢

相關問題