0
在用戶註冊到使用Devise的Rails 3.2.3應用程序後,會觸發after_create回調,它會嘗試創建組織記錄。after_create回調:flash消息
如果這個create
驗證失敗,我怎麼能得到顯示的錯誤信息?我應該重寫設備控制器嗎?事情是,這些錯誤與組織創建有關,而不是用戶(我有一個漂亮的香草設計用戶模型設置)。
我做這樣的事情在用戶模式:
# after_create callback method
...
unless new_org_user.save
errors.add("Warning", "Organisation is invalid")
end
...