1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00

removed dependency to discoutinued protected_attributes + fixed auth_provider

This commit is contained in:
Sylvain 2020-03-30 16:17:32 +02:00
parent 44f927d38e
commit f9e18ca580
3 changed files with 3 additions and 5 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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