2017-07-03 44 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')现在显示数据查询

相关问题