rails/rails — pull request #17497 by eljojo (2014-11-03 19:03:27+00:00)
Title: Setting scopes optionally when using enums in ActiveRecord

Currently, when creating an enum with the with the values ``enum status: [:new, :old]`` on a model, an exception is raised so as to not overwrite ``Model.new``.

```
ArgumentError: You tried to define an enum named "status" on the model "Product", but this will generate a class method "new", which is already defined by Active Record.
```

This allows to pass an options argument when defining an enum, so the scope methods are not created.
In practice, it would look like this:

```ruby
enum({ status: :new }, { scope: false })
```

I'm not a big fan of being forced to use brackets and explicit hashes, but that's the way ruby works. I'm open to suggestions/feedback :smiley: