paulelliott / fabrication

This project has moved to GitLab! Please check there for the latest updates.
https://gitlab.com/fabrication-gem/fabrication
MIT License
998 stars 97 forks source link

Add support for custom generators #285

Closed jodosha closed 8 years ago

jodosha commented 8 years ago

This opens the possibility for third-party gems to build bridges between Fabrication and non-officially supported ORMs.

class CustomGenerator < Fabrication::Generator::Base
  def self.supports?(klass)
    # detect if it can support klass
  end

  # customize the behavior
end

Fabrication.configure do |config|
  config.generators << CustomGenerator
end

I want to build an hanami-fabrication gem to support the upcoming version of hanami-model which uses rom as engine. That's why it would be great if you can accept this proposal.


Thank you for Fabrication 💚

paulelliott commented 8 years ago

This is really cool! Thanks for making this PR!

Would you mind adding this to the docs? You can make a PR to https://github.com/paulelliott/fabrication-site to get it up on https://www.fabricationgem.org.

paulelliott commented 8 years ago

I just cut version 2.16.0 with this change.

jodosha commented 8 years ago

Thank you very much! 😄