diff --git a/app/models/auth_provider.rb b/app/models/auth_provider.rb index 8ec142979..e5be9b285 100644 --- a/app/models/auth_provider.rb +++ b/app/models/auth_provider.rb @@ -17,12 +17,10 @@ class AuthProvider < ApplicationRecord belongs_to :providable, polymorphic: true, dependent: :destroy accepts_nested_attributes_for :providable - # add gem 'protected_attributes_continued' for Rails 5+ - # attr_accessible :name, :providable_type, :providable_attributes before_create :set_initial_state - def build_providable(params, _assignment_options) + def build_providable(params) raise "Unknown providable_type: #{providable_type}" unless PROVIDABLE_TYPES.include?(providable_type) self.providable = providable_type.constantize.new(params) diff --git a/app/models/profile.rb b/app/models/profile.rb index 47030775f..bea552509 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -28,7 +28,7 @@ class Profile < ApplicationRecord blacklist = %w[id user_id created_at updated_at] # model-relationships must be added manually additional = [%w[avatar string], %w[address string], %w[organization_name string], %w[organization_address string]] - Profile.column_types + Profile.columns_hash .map { |k, v| [k, v.type.to_s] } .delete_if { |col| blacklist.include?(col[0]) } .concat(additional) diff --git a/app/models/user.rb b/app/models/user.rb index 175ab6fc3..9f580e3e1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -278,7 +278,7 @@ class User < ApplicationRecord sign_in_count current_sign_in_at last_sign_in_at current_sign_in_ip last_sign_in_ip confirmation_token confirmed_at confirmation_sent_at unconfirmed_email failed_attempts unlock_token locked_at created_at updated_at stp_customer_id slug provider auth_token merged_at] - User.column_types + User.columns_hash .map { |k, v| [k, v.type.to_s] } .delete_if { |col| blacklist.include?(col[0]) } end