diff --git a/app/models/concerns/proposition_accepting.rb b/app/models/concerns/proposition_accepting.rb deleted file mode 100644 index 91323e8..0000000 --- a/app/models/concerns/proposition_accepting.rb +++ /dev/null @@ -1,7 +0,0 @@ -module PropositionAccepting - extend ActiveSupport::Concern - - included do - has_many :propositions, as: :proposition_accepting - end -end diff --git a/app/models/proposition.rb b/app/models/proposition.rb index 8c16d93..dd62544 100644 --- a/app/models/proposition.rb +++ b/app/models/proposition.rb @@ -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] diff --git a/app/models/track.rb b/app/models/track.rb index a8bf6f1..f33bb85 100644 --- a/app/models/track.rb +++ b/app/models/track.rb @@ -1,6 +1,4 @@ class Track < ActiveRecord::Base - include PropositionAccepting - belongs_to :conference has_many :events diff --git a/db/migrate/20150814204500_remove_proposition_accepting_fields_from_propositions.rb b/db/migrate/20150814204500_remove_proposition_accepting_fields_from_propositions.rb new file mode 100644 index 0000000..05a508d --- /dev/null +++ b/db/migrate/20150814204500_remove_proposition_accepting_fields_from_propositions.rb @@ -0,0 +1,5 @@ +class RemovePropositionAcceptingFieldsFromPropositions < ActiveRecord::Migration + def change + remove_reference :propositions, :proposition_accepting, index: true, foreign_key: true, polymorphic: true + end +end diff --git a/spec/factories/propositions.rb b/spec/factories/propositions.rb index 72287fc..c2b69aa 100644 --- a/spec/factories/propositions.rb +++ b/spec/factories/propositions.rb @@ -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 diff --git a/spec/models/proposition_spec.rb b/spec/models/proposition_spec.rb index 0d512f3..80e5731 100644 --- a/spec/models/proposition_spec.rb +++ b/spec/models/proposition_spec.rb @@ -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