Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Fixed Persisted Updating through #{singular}_list= (currently does not update frozen_{singular}_list) #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions lib/dm-tags/dm_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def #{singular}_list

def #{singular}_list=(string)
@#{singular}_list = string.to_s.split(',').map { |name| name.gsub(/[^\\w\\s_-]/i, '').strip }.uniq.sort

update_#{association}
end

alias_method :#{singular}_collection=, :#{singular}_list=
Expand Down
4 changes: 4 additions & 0 deletions lib/dm-tags/tagging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ class Tagging

belongs_to :tag

# Datamapper doesnt throw the next line in apparently,
# or theres an error before it gets added..whatever
property :tag_id, Integer

def taggable
taggable_type.get!(taggable_id)
end
Expand Down