Remove the PropositionAccepting abstraction
This commit is contained in:
parent
4e3ff3eacc
commit
d279ab6f0d
|
@ -1,7 +0,0 @@
|
|||
module PropositionAccepting
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
has_many :propositions, as: :proposition_accepting
|
||||
end
|
||||
end
|
|
@ -1,6 +1,5 @@
|
|||
class Proposition < ActiveRecord::Base
|
||||
belongs_to :proposer, class_name: 'User'
|
||||
belongs_to :proposition_accepting, polymorphic: true
|
||||
belongs_to :proposable, polymorphic: true
|
||||
|
||||
enum status: [:undecided, :approved, :rejected, :backup]
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
class Track < ActiveRecord::Base
|
||||
include PropositionAccepting
|
||||
|
||||
belongs_to :conference
|
||||
has_many :events
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class RemovePropositionAcceptingFieldsFromPropositions < ActiveRecord::Migration
|
||||
def change
|
||||
remove_reference :propositions, :proposition_accepting, index: true, foreign_key: true, polymorphic: true
|
||||
end
|
||||
end
|
|
@ -1,7 +1,6 @@
|
|||
FactoryGirl.define do
|
||||
factory :proposition do
|
||||
association :proposer, factory: :user
|
||||
association :proposition_accepting, factory: :track
|
||||
association :proposable, factory: :event
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,16 +6,10 @@ RSpec.describe Proposition, type: :model do
|
|||
expect(create(:proposition, proposer: user).proposer).to eq user
|
||||
end
|
||||
|
||||
it 'belongs to a proposition_accepting' do
|
||||
track = create :track
|
||||
expect(create(:proposition, proposition_accepting: track).proposition_accepting).to eq track
|
||||
end
|
||||
|
||||
it 'belongs to a proposable' do
|
||||
event = create :event
|
||||
expect(create(:proposition, proposable: event).proposable).to eq event
|
||||
end
|
||||
|
||||
it 'is invalid without an existing proposition_accepting'
|
||||
it 'is invalid without an existing proposable'
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue