如何从ror中的控制器传递参数?

时间:2017-07-03 06:56:57

标签: ruby-on-rails

我想显示员工出勤表中的两列,即日期和现在,但无法显示 -

这是我的展示页面 -

<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

1 个答案:

答案 0 :(得分:0)

错误解决了我替换了来自@employee_attendances = EmployeeAttendance.where(现在:&#39; H&#39;)现在显示数据的查询

相关问题