1
我曾在舊項目中工作,但可能會在更新的版本中更改此項目。我目前正在使用Devise 2.0.4。我試圖我在遷移過程中創建新的用戶使用如何在遷移期間在Devise中創建新用戶
User.create :email => '[password]',
:password => '[password]',
:password_confirmation => '[password]'
,但是當我這樣做,它有以下錯誤
rake aborted!
An error has occurred, this and all later migrations canceled:
ActionView::Template::Error
Tasks: TOP => db:migrate:reset => db:migrate
(See full trace by running task with --trace)
任何幫助,將不勝感激中止!
或者,我可以使用rails shell創建用戶,但爲了保持一致性,我希望每次都有一個默認用戶啓動。
爲什麼你不使用種子? – prasvin 2012-03-02 05:30:47
好問題。主要是因爲我記得有一個概念,但不記得名字,當我搜索我所知道的時候,種子沒有出現。 – 2012-03-02 05:57:57
所以,如果這個問題解決了,可能是你應該添加一個答案並關閉問題。但是,我不介意自己添加一個答案:P :) – prasvin 2012-03-02 06:21:43