tomichj / invitation

A Rails gem that can send 'scoped' invitations
MIT License
75 stars 28 forks source link

Use a concern instead of a class so that Invite model can be easily extended in projects #24

Open 00dav00 opened 5 years ago

00dav00 commented 5 years ago

Today I was in the need of extending Invite class in a project using the gem. After some time looking into the options I did some dirty trick to monkey patch the invite class cause just creating a file under app/models completely shadowed the gem model.

require "#{Gem.loaded_specs['invitation'].full_gem_path}/app/models/invite.rb"

 class Invite
   # Custom code here
end

I think it would be useful for the Invite model to be in the project itself and use a concern to add the required behavior, so that it can be extended when the project needs it. The invite.rb file could be created by the generator. WDYT?

I would be more than happy to create a PR for this.