Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Bug: scope_for_create with polymorphic association #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions spec/squeel/adapters/active_record/relation_extensions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,17 @@ module ActiveRecord
end
end

it 'creates new records with values from a polymorphic association' do
if activerecord_version_at_least '4.0.0'
article = Article.first
note = Note.where(notable: article).new
note.notable_id.should eq article.id
note.notable_type.should eq 'Article'
else
pending 'Not required pre-4.0'
end
end

end

describe '#as' do
Expand Down