Open schwern opened 4 years ago
I am in a bit of a pickle here since I havn't touched rails since v3. How does one go about supporting backwards compatibility for a gem such as this?
@KimNorgaard Since most of the code remains the same, we could write a module with all the common code, and then maintain Rails v3 and Rails v4+ wrapper files and load one or the other as appropriate for the Rails version.
However, considering that the last release of Rails v3 was 10 years ago, I would say it's much simpler to bump to version 2 to indicate a breaking change. Existing Rails v3 users would be safe as they have gem 'validates_hostname', '~> 1'
, and document they should remain with v1, and everyone else move to gem 'validates_hostname', '~> 2'
@KimNorgaard Since most of the code remains the same, we could write a module with all the common code, and then maintain Rails v3 and Rails v4+ wrapper files and load one or the other as appropriate for the Rails version.
However, considering that the last release of Rails v3 was 10 years ago, I would say it's much simpler to bump to version 2 to indicate a breaking change. Existing Rails v3 users would be safe as they have
gem 'validates_hostname', '~> 1'
, and document they should remain with v1, and everyone else move togem 'validates_hostname', '~> 2'
I'm fine going forwards with v2.0.0. Please resolve the conflicts, update version info and let me know and I'll restart the review, tag the release and release a new gem.
Rails 4 introduced ActiveModel, ActiveModel::Validations and ActiveModel::EachValidator. Instead of injecting ourselves into ActiveRecord::Base, we will be automatically picked up. This fixes #10.
We can now also be used on ActiveModel as well as ActiveRecord. This simplifies testing.
Also