acts-as-taggable-on
acts-as-taggable-on copied to clipboard
AATO 6.0.X does not work with new records
Hi, I've found that in the recent version of this gem (6.0.x) when you instantiate a new record or call .build on collection association the tagging is not properly saved because the taggable is blank and then the record that acts as taggable cant be saved either
expect(event.save).to be_truthy # saves ok
# kind is the AATO and participable_kinds is the acts_as_taggable_on :participable_kinds
event.participations.build(participable: user, participable_kinds: [kind])
expect(event.save).to be_truthy # fails with active record errors on tags
the error on event
instance is @details={:"participations.participable_kind_taggings"=>[{:error=>:invalid}]},
it seems the participation
instance can't be saved because the tagging triggered a validation error and the tagging is not saved because taggable_id is blank, because the participation
is not saved ....
this spec was green on previous version of AATO . I just upgraded because i'm upgrading to rails 5.2 from rails 4.2 with the AATO 3.5.0 version
I can confirm that the spec above pass if I set: optional:true
belongs_to :taggable, polymorphic: true, optional: true
in the Tagging
class of the gem
Please merge!
Are there any efforts to merge this in near future?
@robotex82 you can use:
gem "acts-as-taggable-on", git: "https://github.com/michelson/acts-as-taggable-on"
in your gemfile to get master branch
updated for rails 6.1