Skip to content

Commit

Permalink
Merge branch 'hotfix/0.9.1' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
thornomad committed Apr 29, 2021
2 parents 4c825c7 + 04757ca commit 86145b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
enumbler (0.9.0)
enumbler (0.9.1)
activerecord (>= 5.2.3, < 7)
activesupport (>= 5.2.3, < 7)

Expand Down
8 changes: 7 additions & 1 deletion lib/enumbler/enabler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def define_dynamic_methods_and_constants_for_enumbled_model(enumble)
end

define_singleton_method(any_method_name) do
where(id: enumble.id).exists?
exists?(id: enumble.id)
rescue NoMethodError
raise Enumbler::Error, "The attribute #{attr} is not supported on this Enumble."
end
Expand Down Expand Up @@ -452,8 +452,14 @@ def raise_error_if_model_does_not_support_attributes(attributes)

return if unsupported_attrs.blank?

ActiveRecord::Migration.check_pending!

raise Enumbler::Error,
"The model #{self} does not support the attribute(s): #{unsupported_attrs.keys.map(&:to_s).to_sentence}"
rescue ActiveRecord::PendingMigrationError
warn "[Enumbler Warning] => The model #{self} does not currently support the attribute(s): #{unsupported_attrs.keys.map(&:to_s).to_sentence}." \
" You have a pending migration which hopefully would remedy this! If not, you need to add a migration for this attibrute or" \
" remove it from the Enumbler."
rescue ActiveRecord::StatementInvalid
warn "[Enumbler Warning] => Unable to find a table for #{self}."\
"This is to be expected if there is a pending migration; however, if there is not then something is amiss."
Expand Down
2 changes: 1 addition & 1 deletion lib/enumbler/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Enumbler
VERSION = "0.9.0"
VERSION = "0.9.1"
end

0 comments on commit 86145b7

Please sign in to comment.