Error registering `store_attributes` as `attributes` when passing in a Type object (not a symbol)
Description
When you register attributes via store_attributes and pass in a type instance (instead of a symbol), with self.store_attribute_register_attributes = true the attribute registration code still calls ActiveRecord::Type.lookup, which errors because lookup expects a symbol. We should only call Type.lookup when the type is given as a symbol.
This was noticed when trying to use store_model types in conjunction with store_attributes and registering store_attributes as attributes but it can be reproduced without the store_model gem as well.
Steps to Reproduce
Have self.store_attribute_register_attributes = true and pass in a type instead of a symbol for a store_attribute call (example below from the specs)
class UserWithAttributes < ActiveRecord::Base
self.table_name = "users"
self.store_attribute_register_attributes = true
store_accessor :jparams, active: :boolean, birthday: :date, prefix: "json", suffix: "value"
store_attribute :jparams, :inner_json, :json
store_attribute :hdata, :salary, :integer
store_attribute :hdata, :hours, ActiveRecord::Type.lookup(:integer)
store :custom, accessors: [:custom_date, price: :money_type]
end
When you try to create the class you will get ArgumentError: Unknown type #<ActiveModel::Type::Integer:0x000...