diff --git a/README.adoc b/README.adoc index c9080ffc..c29c85ea 100644 --- a/README.adoc +++ b/README.adoc @@ -385,6 +385,24 @@ class Transaction < ActiveRecord::Base end ---- +=== Enums [[enums]] + +Prefer hash syntax over arrays for `enums`. + +[source,ruby] +---- +class Transaction < ActiveRecord::Base + # bad - implicit values - ordering in array matters + enum type: %i[credit debit] + + # good - explicit values - ordering does not matter + enum type: { + credit: 0, + debit: 1, + } +end +---- + === Macro Style Methods [[macro-style-methods]] Group macro-style methods (`has_many`, `validates`, etc) in the beginning of the class definition.