#25 ✓resolved
Scott M. Likens

Fix tagging plugin

Reported by Scott M. Likens | July 28th, 2008 @ 06:48 AM | in 0.5

How about moving tags to -core, as it would be easier to build the tag cloud, and handle tagging in the current Model schema.

@Article.tags.each do |tag|

buildit

end

Reference to the article easily, We can keep the tag cloud as a plugin if you want, however having basic tag support internally should be a win win.

Thoughts?

Comments and changes to this ticket

  • Elliott Draper

    Elliott Draper July 30th, 2008 @ 07:08 PM

    • Assigned user set to “Elliott Draper”
    • Title changed from “Moving Tagging Support to -core” to “Fix tagging plugin”
    • State changed from “new” to “open”
    • Tag changed from articles, feather to articles, feather, tagging, tags
    • Milestone set to 0.5

    No dice here, lets keep core as light as possible (that's one of the core concepts for Feather).

    After discussing in IRC, I think there isn't a solid enough reason to do this, we just need to fix the tagging plugin up if it isn't currently working properly. I'll rename the ticket to that, and assign it to myself.

  • Scott M. Likens

    Scott M. Likens July 30th, 2008 @ 07:20 PM

    Just rename the ticket, I've taken a whack at it, and It's beyond my

    current skills.

    On Jul 30, 2008, at 4:09 PM, Lighthouse wrote:

  • AJ

    AJ July 30th, 2008 @ 11:50 PM

    I've been thinking about this one, and in particular, moving forward to make everything an article.

    I've grown considerably attached to the idea that currently, Articles should implement a one-to-many-through relationship to tags through tagmaps, and have this functionality available in the core, and to anything that is based off Articles/Items/CollectionPresenters in the future - tag tweets, tag photos..

    I, unlike Scott, believe that tags should be in seperate tables and not in the article model, but I do believe this functionality should be in the core.

    class Article
      include DataMapper::Resource
      has n, :taggings
      has n, :tags, :through => :taggings
    end
     
    class Tag
      include DataMapper::Resource
     
      has n, :taggings
      has n, :photos, :through => :taggings
    end
     
    class Tagging
      include DataMapper::Resource
     
      belongs_to :tag
      belongs_to :photo
    end
    

    So, wanna fight?

  • Scott M. Likens

    Scott M. Likens July 30th, 2008 @ 11:50 PM

    All I'm saying is put the actual tags in Article.

    Doesn't have to be anything cute or special,

    Space tagged tags

    "Ruby Linux Bob Jones"

    dunno why we have photo's, but okay.

    On Jul 30, 2008, at 8:22 PM, Lighthouse wrote:

  • AJ

    AJ July 31st, 2008 @ 12:17 AM

    And how do you propose routing /tags/ruby, then?

    with one-to-many through, we can simply Tag.first(:name => 'ruby').articles

  • AJ

    AJ July 31st, 2008 @ 08:19 AM

    • Assigned user changed from “Elliott Draper” to “AJ”

    w00t

    dm-tags

    aj@junglist /tmp$ cat test.rb
    #!/usr/bin/env ruby
    require 'rubygems'
    require 'dm-core'
    require 'dm-tags'
    
    DataMapper::Logger.new(STDOUT, :debug)
    DataMapper.setup(:default, "sqlite3::memory:")
    
    class Article
      include DataMapper::Resource
      property :id, Integer, :serial => true
      property :title, String, :nullable => false, :length => 255
      property :content, Text, :nullable => false
    end
    
    DataMapper.auto_migrate!
    
    @article = Article.new(:title => "First Article", :content => "Bollocks").save
    
    class Article
      has_tags
    end
    
    DataMapper.auto_upgrade!
    
    @article = Article.first
    @article.tag_list = "tag, tag two"
    @article.save
    
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ DROP TABLE IF EXISTS "articles"
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('articles')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ SELECT sqlite_version(*)
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ CREATE TABLE "articles" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "title" VARCHAR(255) NOT NULL, "content" TEXT NOT NULL)
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ DROP TABLE IF EXISTS "taggings"
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('taggings')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ CREATE TABLE "taggings" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "tag_id" INTEGER NOT NULL, "taggable_id" INTEGER NOT NULL, "taggable_type" VARCHAR(50) NOT NULL, "tag_context" VARCHAR(50) NOT NULL)
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ DROP TABLE IF EXISTS "tags"
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('tags')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ CREATE TABLE "tags" ("id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "name" VARCHAR(50) NOT NULL)
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ INSERT INTO "articles" ("content", "title") VALUES ('Bollocks', 'First Article')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('articles')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('articles')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('articles')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('articles')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('articles')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ ALTER TABLE "articles" ADD COLUMN "frozen_tag_list" VARCHAR(50)
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('taggings')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('taggings')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('taggings')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('taggings')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('taggings')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('taggings')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('tags')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('tags')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ PRAGMA table_info('tags')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ SELECT "id", "title", "frozen_tag_list" FROM "articles" ORDER BY "id" LIMIT 1
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ SELECT "id", "name" FROM "tags" WHERE "name" = 'tag' ORDER BY "id" LIMIT 1
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ SELECT "id", "tag_id", "taggable_id", "taggable_type", "tag_context" FROM "taggings" WHERE "tag_context" = 'tags' AND "taggable_id" IN (1) AND "taggable_type" = 'Article' ORDER BY "id"
    Model#create! is deprecated. It is moving to dm-validations, and will be used to create a record without validations
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ INSERT INTO "tags" ("name") VALUES ('tag')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ SELECT "id", "name" FROM "tags" WHERE "name" = 'tag two' ORDER BY "id" LIMIT 1
    Model#create! is deprecated. It is moving to dm-validations, and will be used to create a record without validations
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ INSERT INTO "tags" ("name") VALUES ('tag two')
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ UPDATE "articles" SET "frozen_tag_list" = 'tag,tag two' WHERE "id" = 1
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ INSERT INTO "taggings" ("taggable_type", "tag_context", "tag_id", "taggable_id") VALUES ('Article', 'tags', 1, 1)
    Thu, 31 Jul 2008 12:18:09 GMT ~ debug ~ INSERT INTO "taggings" ("taggable_type", "tag_context", "tag_id", "taggable_id") VALUES ('Article', 'tags', 2, 1)
    

    How about them apples? Note that, the problem here is, when this plugin is deleted, the articles table would still have a frozen_tag_list column.. We also have the issue of trying to route to /tags/blah, as this doesn't implement a one-to-many-through assoc as far as I can see..

  • Scott M. Likens

    Scott M. Likens July 31st, 2008 @ 06:45 PM

    Eeeexcellent.

    Very easy, I just couldn't figure out why it had to be so complicated.

    On Jul 31, 2008, at 4:13 AM, Lighthouse wrote:

  • Elliott Draper

    Elliott Draper August 8th, 2008 @ 08:54 PM

    I like this solution - it's clean-cut and allows us to still build the functionality as a plugin, while still hopefully being fully featured.

    How have you got on with the association problem you raised that'd affect the routing? As for the plugin deletion stuff, we really haven't yet dealt with that for the plugin system as a whole - ideally we should be looking to fully unload anything that a plugin brought to the table once it is deleted, currently we don't do this though.

  • AJ

    AJ August 8th, 2008 @ 09:35 PM

    Dm-tags still gives the association for routing so this shouldn't be a problem.

    Haven't had any time to work on this, though.

    On 9/08/2008, at 12:54 PM, Lighthouse support@lighthouseapp.com wrote:

  • AJ

    AJ August 15th, 2008 @ 09:55 PM

    • State changed from “open” to “resolved”

    Pushed to edge

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The core code for Feather, a lightweight Merb-based blogging engine.

People watching this ticket

Pages