[英]Ruby on Rails: Sortable Table Columns Error
我正在嘗試遵循有關可排序表列的鐵路廣播教程,但出現錯誤。
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
有任何想法嗎? 任何幫助將不勝感激。 我是紅寶石的新手,所以輕松一點:)
抱歉,我不明白在學習本教程時必須命名默認列。 我的默認列應該是project_name而不是name。
謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.