【发布时间】:2018-05-28 16:14:24
【问题描述】:
我的项目基本上是一个提醒应用。项目在这里:https://todo-app-back-end-prospeed.c9users.io/。查看蓝色复选框,我正在研究如何获得连接数据库的按钮。我希望当用户选中复选框时,布尔值是我的数据:<Todo id: 24, description: "Publish project", pomodoro_estimate: 1, complete: nil, complete: nil 转为真或假。这是我的 index.html.erb:
`
<body>
<div class="container2">
<h1 id ="list">Workshop Todo List</h1>
<ul>
<% @todos.each do |todo| %>
<li>
<label class="container">
<input type="checkbox"/ checked="checked">
<a href = "/show/<%= todo.id %>"><%= todo.description %></a>
<span class="pomodoro-estimate"><%= todo.pomodoro_estimate %> pomodoro</span>
<span class="checkmark"></span>
</label>
</li>
<% end %>
</ul>
<a class="noColor" href="/new/"><input class="add-new-todo-button" type="submit" value="Add todo"/></a>
<h1 id="Pomodoro-technique">What is a pomodoro estimate?</h1>
<p id="Pomodoro-technique-info">
<strong>1 pomodoro = 25 minutes + 5 minutes break.</strong><br>
For more info: <a href="https://www.focusboosterapp.com/the-pomodoro-technique">https://www.focusboosterapp.com/the-pomodoro-technique</a>
</p>
</div>
</body>
请随时为我指明正确的方向。
【问题讨论】:
-
我不明白这个问题。您想以哪种方式将其连接到数据库?按钮应该做什么以及它在代码中的什么位置?你应该检查这个apidock.com/rails/ActionView/Helpers,因为你的代码中有很多东西需要改变。
标签: html ruby-on-rails database