我正在尝试遵循有关Sortable Table Columns的 railcasts 教程,但出现错误。
SQLite3::SQLException: 没有这样的列: 名称: 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
有任何想法吗?任何帮助都将不胜感激。我是 ruby on rails 的新手,所以放轻松:)