Closed matsales28 closed 5 months ago
This PR adds Rubocop and code review adjustments on top of #1425:
Quoting @mswiszcz:
Allows to create tests checking set foreign_type class Visitor < ActiveRecord::Base belongs_to :location, foreign_type: :facility_type, polymorphic: true end class Hotel < Location has_many :visitors, inverse_of: :location, foreign_type: :facility_type, as: :location end class PrisonCell < Location has_one :visitor, inverse_of: :location, foreign_type: :facility_type, as: :location end expect(Visitor.new).to belong_to(:location).with_foreign_type(:facility_type) expect(Hotel.new).to have_many(:visitors).with_foreign_type(:facility_type) expect(PrisonCell.new).to have_one(:visitor).with_foreign_type(:facility_type)
Allows to create tests checking set foreign_type
class Visitor < ActiveRecord::Base belongs_to :location, foreign_type: :facility_type, polymorphic: true end class Hotel < Location has_many :visitors, inverse_of: :location, foreign_type: :facility_type, as: :location end class PrisonCell < Location has_one :visitor, inverse_of: :location, foreign_type: :facility_type, as: :location end
expect(Visitor.new).to belong_to(:location).with_foreign_type(:facility_type) expect(Hotel.new).to have_many(:visitors).with_foreign_type(:facility_type) expect(PrisonCell.new).to have_one(:visitor).with_foreign_type(:facility_type)
All credits go to @mswiszcz for this contribution.
This PR adds Rubocop and code review adjustments on top of #1425:
Quoting @mswiszcz:
All credits go to @mswiszcz for this contribution.