pocke / rbs_rails

Apache License 2.0
280 stars 30 forks source link

Add additional enum methods #276

Open derikson opened 6 months ago

derikson commented 6 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 6 months ago

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