Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translating a delegated enum #121

Open
Startouf opened this issue Apr 17, 2016 · 1 comment
Open

Translating a delegated enum #121

Startouf opened this issue Apr 17, 2016 · 1 comment

Comments

@Startouf
Copy link

Class Student
  delegate :type, to: school, prefix: :true
end

class School
  include SimpleEnum::Mongoid
  as_enum :type, [:business, :technical]
end

te(@student, school_type) # Doesn't seem to work

Taking care of delegated stuff can become pretty nasty I suppose... here the translation should propagate from the Student to the School model.

@lwe
Copy link
Owner

lwe commented Apr 18, 2016

Mhh, good point, any proposals on how to "fix" this - but I think delegates are nearly impossible to handle. One possible solution is the ability to append an argument scope: :school or something, that overrides Student?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants