I want to create a timetable app with ruby ​​on rails

If there is something like a timetable table, click one cell in that table to display the list of lessons corresponding to that cell.
(Click the cell for Wednesday 2nd period to display the list of classes for Wednesday 2nd period)


For example, if you click the cell for Wednesday 1st period, not only the class for Wednesday 1st period but all the lesson data will be displayed.
Is this due to a bad search method?


      <% days = ["Mon", "Tue", "Wed", "Thu", "Fri"]%>
      <% hours = [1, 2, 3, 4, 5]%>
      <tr><th>Time/Day of the Week</th><th>Monday</th><th>Tuesday</th><th>Wednesday</th><th>Thursday</th><th>Friday</th></tr>
      <% hours.each do | hour |%>
          <td><% = hour%></td>
            <% days.each do | day |%>
              <td><% = link_to "# {day}-# {hour} timed", search_class_classrooms_path, day: "# {day} # {hour}"%></td>
            <% end%>
      <% end%>
def search_class
    @classrooms = Classroom.where ("week LIKE (?)", "% # {params [: day]}%")
class CreateClassrooms</pre>
<pre><code>Class data
name, term, week
Functional Machine Drafting I (Functional Machine), Late, Wednesday-3 Times Wednesday-4 Times
Mechanical Design Drafting I (Bio), Late, Monday-1st period Friday-4th period
Transport Phenomenon [B], Late, Friday-1 Time
Organic Chemistry I, Late, Friday-5 Times
  • Answer # 1

    Design your Classroom model. Maybe there will be items such as weekday and hour.
    search_class_classrooms_path (weekday: day, hour: hour)
    If you pass it like this, the data will be passed in params, so you can search with it.