README.md in str_enum-0.1.5 vs README.md in str_enum-0.1.6
- old
+ new
@@ -5,11 +5,14 @@
String enums for Rails!! :tada:
- scopes
- validations
- accessor methods
+- update methods
+[![Build Status](https://travis-ci.org/ankane/str_enum.svg?branch=master)](https://travis-ci.org/ankane/str_enum)
+
## Getting Started
Add this line to your application’s Gemfile:
```ruby
@@ -51,10 +54,17 @@
```ruby
user.active?
user.archived?
```
+#### Update Methods [master]
+
+```ruby
+user.active!
+user.archived!
+```
+
#### Forms
```erb
<%= f.select :status, User.statuses.map { |s| [s.titleize, s] } %>
```
@@ -63,11 +73,16 @@
Choose which features you want with:
```ruby
class User < ActiveRecord::Base
- str_enum :status, [:active, :archived], scopes: false, validate: false, accessor_methods: false
+ str_enum :status, [:active, :archived],
+ scopes: false,
+ validate: false,
+ accessor_methods: false,
+ update_methods: false,
+ default: nil
end
```
Prevent method name collisions with the `prefix` and `suffix` options.
@@ -81,9 +96,13 @@
User.archived_address
# accessor methods
user.active_address?
user.archived_address?
+
+# update methods
+user.active_address!
+user.archived_address!
```
## History
View the [changelog](https://github.com/ankane/str_enum/blob/master/CHANGELOG.md)