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

Better support for inheritance #194

Open
mvz opened this issue Jan 2, 2022 · 0 comments
Open

Better support for inheritance #194

mvz opened this issue Jan 2, 2022 · 0 comments

Comments

@mvz
Copy link
Owner

mvz commented Jan 2, 2022

Right now, inheriting models from a superclass is awkward, because you're supposed to include HapppyMapper in each subclass to copy and inherit the attribute lists defined on the class

So you end up with this:

class Super
  include HappyMapper
end

# And for each subclass:
class SubClass < Super
  include HappyMapper
end

This will work but is awkward:

class Super
  include HappyMapper

  def self.inherited(base)
    super
    base.include(HappyMapper)
  end
end

HappyMapper should really define the inherited hook itself.

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

No branches or pull requests

1 participant