我正在使用AASM.根据条件可能有2种不同的状态例如:
aasm_event :completes do
transitions :to => condition? ? :complete : :terminate,
:from => [:active]
end
Run Code Online (Sandbox Code Playgroud)
这样做的目的是因为我使用遗留代码,并且有很多"完成"调用,终止状态是新的.
我已经尝试在新文件中覆盖状态机了
aasm_event :completes do
transitions :to => :terminate,
:from => [:active]
end
Run Code Online (Sandbox Code Playgroud)
但它没有奏效,它仍然会完成状态
发现rails 5有一个原生的uuid集成,想尝试一下但是我收到这个错误:
== 20170330041631 EnableUuidExtension: migrating ==============================
-- enable_extension("uuid-ossp")
-> 0.0000s
== 20170330041631 EnableUuidExtension: migrated (0.0001s) =====================
== 20170331035925 CreateUsers: migrating ======================================
-- create_table(:users, {:id=>:uuid})
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'uuid PRIMARY KEY, `name` varchar(255), `username` varchar(255), `password_digest' at line 1: CREATE TABLE `users` (`id` uuid …Run Code Online (Sandbox Code Playgroud)