这里是我的架构文件..Entrys没有正确保存到我的数据库?
ActiveRecord::Schema.define(:version => 20120505115340) do
create_table "clients", :force => true do |t|
t.string "name"
t.string "detail"
t.string "more_detail"
t.string "more_details"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "jobs", :force => true do |t|
t.string "name"
t.integer "number"
t.string "responsible"
t.string "monthly"
t.string "quarterly"
t.string "other"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
end
,这里是我的移民文件的..
class CreateClients < ActiveRecord::Migration
def change
create_table :clients do |t|
t.string :name
t.string :detail
t.string :more_detail
t.string :more_details
t.timestamps
end
end
end
class CreateJobs < ActiveRecord::Migration
def change
create_table :jobs do |t|
t.string :name
t.integer :number
t.string :responsible
t.string :monthly
t.string :quarterly
t.string :other
t.timestamps
end
end
end
我认为文件中,我有它设置,使是翻出client.name
,它显示的用户<%= link_to client.name, client_path(client) %>
。
但是,当我创建新条目时,所有即时回复为/clients/1
而不是我在表单中指定的名称。
当我尝试迁移数据库时,什么也没有发生,然后当我尝试删除他的DB重新开始时,它告诉我它甚至存在。
但我在视图中调用的属性不是id。 在我尝试将数据库迁移到aadd作业表之前,此工作正在进行。 – Keva161
所以..在我的表单中保存:name属性。为什么只显示客户端ID?正如我刚才所说的那样,它正在显示客户名称。除了尝试使用新模型迁移数据库外,我没有触及我的代码。 我把我的代码放在GitHub上,如果帮助=> https://github.com/keva161/document_manager 我相信这是一个数据库相关的问题,因为当我导航到/ clients /目录并添加一个新的客户端并保存。表单将进入,但不会保存任何信息。 – Keva161