pocke / rbs_rails

Apache License 2.0
285 stars 33 forks source link

Add additional enum methods #276

Open derikson opened 8 months ago

derikson commented 8 months ago

Example:

class User < ApplicationRecord
  enum status: {
    temporary: 1,
    accepted: 2
  }
end

# RBS is generated for these scopes
User.not_temporary
User.not_accepted
# RBS is generated for the mapping method
User.status # => { temporary: 1, accepted: 2 }
derikson commented 8 months ago

Incidentally, is there a reason singleton method signatures are added to the model class instead of using extend GeneratedRelationMethods?