Skip to content

Categories:

Taking TOG out for a spin

A recent post about Tog got me curious, so I thought I’d give it a test drive. According to their site, you could add social networking functionalities as plugins, which is another approach from CommunityEngine (via Rails engines) and Insoshi (a Rails app). The instructions were a little vague, so I thought I’d document the process here (with a few errors along the way).

First off:

togify my_tog_app

You will need to install acts_as_commentable. When creating the commentable migration, it will kick out errors which will require you to install the following plugins:
acts_as_scribe, acts_as_taggable_on_steroids, acts_as_abusable, seo_urls, file_column.

So, here’s the whole diatribe:

ruby script/plugin install http://juixe.com/svn/acts_as_commentable
ruby script/generate migration ActsAsCommentable
# -ERROR - Plugin 'acts_as_scribe' does not exist

script/plugin install git://github.com/linkingpaths/acts_as_scribe.git
ruby script/generate acts_as_scribe_migration
# Error - Plugin 'acts_as_taggable_on_steroids' does not exist (RuntimeError)

ruby script/plugin install http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids
ruby script/generate acts_as_taggable_migration
# Error -  Plugin 'acts_as_abusable' does not exist (RuntimeError)

script/plugin install git://github.com/linkingpaths/acts_as_abusable.git
script/generate acts_as_abusable_migration
# Error - Plugin 'acts_as_state_machine' does not exist (RuntimeError)

ruby script/plugin install http://elitists.textdriven.com/svn/plugins/acts_as_state_machine/trunk

script/generate acts_as_abusable_migration
# Error - Plugin 'seo_urls' does not exist (RuntimeError)
script/plugin install http://svn.redshiftmedia.com/svn/plugins/seo_urls

script/plugin install http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk
script/generate acts_as_abusable_migration
# Error - Plugin 'seo_urls' does not exist (RuntimeError)
script/plugin install http://svn.redshiftmedia.com/svn/plugins/seo_urls

# FINALLY:
script/generate acts_as_abusable_migration - OK
ruby script/generate acts_as_taggable_migration - OK
ruby script/generate acts_as_scribe_migration - OK
ruby script/generate migration ActsAsCommentable - OK

# Need to paste this in:
class ActsAsCommentable < ActiveRecord::Migration
def self.up
create_table "comments", :force => true do |t|
t.column "title", :string, :limit => 50, :default => ""
t.column "comment", :text, :default => ""
t.column "created_at", :datetime, :null => false
t.column "commentable_id", :integer, :default => 0, :null => false
t.column "commentable_type", :string, :limit => 15, :default => "", :null => false
t.column "user_id", :integer, :default => 0, :null => false
end
add_index "comments", ["user_id"], :name => "fk_comments_user"
end

def self.down
drop_table :comments
end
end

Before migrating, Tog needs to copy over some files:

rake tog:plugins:copy_resources

# Doing a rake db:migrate at this point will throw these errors
Adding [:mail_user_observer, :user_observer] to []
== 1 IntegrateTog: migrating ==================================================
== 1 CreateTogConfig: migrating ===============================================
== 1 CreateTogConfig: migrated (0.0000s) ======================================

== 2 PatchCommentsTable: migrating ============================================
-- add_column(:comments, :commentable_type_tmp, :string, {:null=>false, :default=>""})
rake aborted!
SQLite3::SQLException: no such table: comments: ALTER TABLE "comments" ADD "commentable_type_tmp" varchar(255) DEFAULT '' NOT NULL
)

# I edited the migration version number for 001_integrate_tog.rb to 20081011122049_integrate_tog.rb to have it run after the plugin migrations
rake db:migrate

Deleted index.html, started up the server, and voila! A running tog app.

Installing other Tog plugins

I also added Conversatio and Vault, but deleted Picto – it was choking on its migrations.

ruby script/plugin install git://github.com/tog/tog_conversatio.git

ruby script/generate migration install_conversatio

class InstallConversatio < ActiveRecord::Migration
def self.up
migrate_plugin "tog_conversatio", 4
end

def self.down
migrate_plugin "tog_conversatio", 0
end
end

# ADD:
map.routes_from_plugin 'tog_conversatio'

ruby script/plugin install git://github.com/tog/tog_picto.git
# ERROR: acts_as_rateable' does not exist
script/plugin install http://juixe.com/svn/acts_as_rateable
script/generate migration create_acts_as_rateable
#ERROR: Plugin 'acts_as_list' does not exist
script/plugin install acts_as_list

def self.up
create_table "ratings", :force => true do |t|
t.column "rating", :integer, :default => 0
t.column "created_at", :datetime, :null => false
t.column "rateable_type", :string, :limit => 15, :default => "", :null => false
t.column "rateable_id", :integer, :default => 0, :null => false
t.column "user_id", :integer, :default => 0, :null => false
end

add_index "ratings", ["user_id"], :name => "fk_ratings_user"
end

def self.down
drop_table :ratings
end

ruby script/generate migration install_picto
class InstallPicto < ActiveRecord::Migration
def self.up
migrate_plugin "tog_picto", 6
end

def self.down
migrate_plugin "tog_picto", 0
end
end
ERROR during migration: == 5 AddPrivateColumnToPhotoset: migrating ====================================
-- add_column(:photosets, :privacy, :integer)
-> 0.0196s
rake aborted!
wrong number of arguments (1 for 0)

# DELETED picto migration, moving on.
rake tog:plugins:copy_resources

# Install tog vault:
script/plugin install acts_as_tree
ruby script/plugin install git://github.com/tog/tog_vault.git
ruby script/generate migration install_vault

map.routes_from_plugin 'tog_vault'

# Try picto again:
install picto plugin again --force
ruby script/generate migration install_picto

Gave upon Picto.

You can grab a copy of the bare Tog app from GitHub.

Posted in Gems, Tutorials. Tagged with .

One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Fernando Campos said

    I was very valuable for me. I was stuck on the problem migration.
    Best regards!

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.