mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-16 01:06:32 +01:00
fix tags and fix tests
This commit is contained in:
parent
c618d35d3a
commit
0e68ded56a
8 changed files with 856 additions and 836 deletions
|
|
@ -1,17 +1,17 @@
|
|||
|
||||
# The Tagging join model. This model is automatically generated and added to your app if you run the tagging generator included with has_many_polymorphs.
|
||||
|
||||
class Tagging < ActiveRecord::Base
|
||||
|
||||
belongs_to :tag
|
||||
belongs_to :taggable, :polymorphic => true
|
||||
belongs_to :user
|
||||
|
||||
# If you also need to use <tt>acts_as_list</tt>, you will have to manage the tagging positions manually by creating decorated join records when you associate Tags with taggables.
|
||||
# acts_as_list :scope => :taggable
|
||||
|
||||
# This callback makes sure that an orphaned <tt>Tag</tt> is deleted if it no longer tags anything.
|
||||
def after_destroy
|
||||
tag.destroy_without_callbacks if tag and tag.taggings.count == 0
|
||||
end
|
||||
end
|
||||
|
||||
# The Tagging join model. This model is automatically generated and added to your app if you run the tagging generator included with has_many_polymorphs.
|
||||
|
||||
class Tagging < ActiveRecord::Base
|
||||
|
||||
belongs_to :tag
|
||||
belongs_to :taggable, :polymorphic => true
|
||||
# belongs_to :user
|
||||
|
||||
# If you also need to use <tt>acts_as_list</tt>, you will have to manage the tagging positions manually by creating decorated join records when you associate Tags with taggables.
|
||||
# acts_as_list :scope => :taggable
|
||||
|
||||
# This callback makes sure that an orphaned <tt>Tag</tt> is deleted if it no longer tags anything.
|
||||
def after_destroy
|
||||
tag.destroy_without_callbacks if tag and tag.taggings.count == 0
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue