Muck Blogs

Add a blog to any object.

Setup

Install the gem:

sudo gem install muck-blogs

Then add it to your environment.rb:

config.gem "muck-blogs", :lib => 'muck_blogs'

Add tasks to your application’s Rakefile:

require 'muck_blogs/tasks'

Installing the gem will also install dependencies. Specifically Muck Blogs requires Muck Contents. Be sure to properly configure your application for Muck Contents - github.com/tatemae/muck_contents/tree/master

Usage

Configuration

Add ‘enable_post_activities’ to global_config.yml to determine whether or not an activity will be added after a user contributes a post. This requires that the application be configured to use Muck Activities. Note that to enable this functionality the content model will need to have

enable_post_activities: true

Blog model

Create a model called blog in your project and add the following:

class Blog < ActiveRecord::Base
  acts_as_muck_blog
end

This let’s you override or add other methods to the blog model that you see fit.

Content model

Muck Blogs requires Muck Contents. Be sure to setup Muck Content then add acts_as_muck_post to your Content model:

class Content < ActiveRecord::Base
  acts_as_muck_post
  # acts_as_activity_source # Include this if you wish to have entries added to activity feeds upon each new post
end

Attach blogs to a model:

For a given model add ‘has_muck_blog’

class User < ActiveRecord::Base
  has_muck_blog
end

For each model that ‘has_muck_blog’ you will need to setup routing. For a user model this would be:

map.resources :users do |users|
  users.resource :blog, :controller => 'muck/blogs' do |blogs|
    blogs.resources :posts, :controller => 'muck/posts'
  end
end

Copyright © 2009 Muck Your App, released under the MIT license