README.md in str_enum-0.1.0 vs README.md in str_enum-0.1.1
- old
+ new
@@ -1,8 +1,8 @@
# str_enum
-Don’t want to store enums as integers in your database? Introducing...
+Don’t like storing enums as integers in your database? Introducing...
String enums for Rails!! :tada:
- scopes
- validations
@@ -22,41 +22,61 @@
class User < ActiveRecord::Base
str_enum :status, [:active, :archived]
end
```
-The first value will be the initial value. This gives you...
+The first value will be the initial value. This gives you:
-### Scopes
+#### Scopes
```ruby
User.active
User.archived
```
-### Validations
+#### Validations
```ruby
user = User.new(status: "unknown")
user.valid? # false
```
-### Accessor Methods
+#### Accessor Methods
```ruby
user.active?
user.archived?
```
-## Customize
+## Options
-Choose which features you want
+Choose which features you want with:
```ruby
class User < ActiveRecord::Base
str_enum :status, [:active, :archived], scopes: false, validate: false, accessor_methods: false
end
```
+
+Prevent name collisions with the `prefix` option.
+
+```ruby
+class User < ActiveRecord::Base
+ str_enum :address_status, [:active, :archived], prefix: :address
+end
+
+# scopes
+User.address_active
+User.address_archived
+
+# accessor methods
+user.address_active?
+user.address_archived?
+```
+
+## History
+
+View the [changelog](https://github.com/ankane/str_enum/blob/master/CHANGELOG.md)
## Contributing
Everyone is encouraged to help improve this project. Here are a few ways you can help: