我正在尝试关注Sortable Table Columns上的铁路广播教程,我收到了错误。
SQLite3 :: SQLException:没有这样的列:name:SELECT“projects”。* FROM“projects”ORDER BY name asc
我按照教程中的说明操作,唯一改变的是表大小,名称和列名。
这是我的搜索视图:
<table class = "pretty">
<tr>
<th><%= sortable "project_name", "Project name" %> </th>
<th><%= sortable "client", "Client" %></th>
<th>Exception pm</th>
<th>Project owner</th>
<th>Tech</th>
<th>Role</th>
<th>Industry</th>
<th>Financials</th>
<th>Business div</th>
<th>Status</th>
<th>Start date</th>
<th>End date</th>
<th>Entry date</th>
<th>Edited date</th>
<th>Summary</th>
<th>Lessons learned</th>
<th>Customer benifits</th>
<th>Keywords</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @projects.each do |t| %>
<tr>
<td><%= t.project_name %></td>
<td><%= t.client %></td>
<td><%= t.exception_pm %></td>
<td><%= t.project_owner %></td>
<td><%= t.tech %></td>
<td><%= t.role %></td>
<td><%= t.industry %></td>
<td><%= t.financials %></td>
<td><%= t.business_div %></td>
<td><%= t.status %></td>
<td><%= t.start_date %></td>
<td><%= t.end_date %></td>
<td><%= t.entry_date %></td>
<td><%= t.edited_date %></td>
<td><%= t.summary %></td>
<td><%= t.lessons_learned %></td>
<td><%= t.customer_benifits %></td>
<td><%= t.keywords %></td>
<td><%= link_to 'Show', project %></td>
<td><%= link_to 'Edit', edit_project_path(project) %></td>
<td><%= link_to 'Destroy', project, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
编辑:
这是我的数据库架构
ActiveRecord::Schema.define(:version => 20120717141952) do
create_table "projects", :force => true do |t|
t.string "project_name"
t.string "client"
t.string "exception_pm"
t.string "project_owner"
t.string "tech"
t.string "role"
t.string "industry"
t.string "financials"
t.string "business_div"
t.string "status"
t.date "start_date"
t.date "end_date"
t.datetime "entry_date"
t.datetime "edited_date"
t.text "summary"
t.text "lessons_learned"
t.text "customer_benifits"
t.text "keywords"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
end
有什么想法吗?任何帮助都将不胜感激。我是铁轨上的红宝石新手,所以请轻松一下:)
答案 0 :(得分:0)
抱歉,我不明白在完成本教程时我必须命名默认列。我的默认列是project_name,而不是name。
由于