Sha256: e06ad281b1fa3d63ede01f4caae7d46a9f35b48deb866a6af0e47e5d934ab163

Contents?: true

Size: 1.08 KB

Versions: 25

Compression:

Stored size: 1.08 KB

Contents

module ActiveRecord
  module Acts #:nodoc:
    module MuckFeedOwner # :nodoc:

      def self.included(base)
        base.extend(ClassMethods)
      end
  
      module ClassMethods
        
        # +acts_as_muck_feed_owner+ adds identity feeds to a given object.  The feeds
        # attached to the object in this way are then assumed to be produced by the object.
        # For example, if a user writes a blog the blog could be associated with the user in this way.
        def acts_as_muck_feed_owner
          has_many :identity_feeds, :as => :ownable
          has_many :own_feeds, :through => :identity_feeds, :source => :feed, :order => 'created_at desc'
          include ActiveRecord::Acts::MuckFeedOwner::InstanceMethods
          extend ActiveRecord::Acts::MuckFeedOwner::SingletonMethods
        end
      end

      # class methods
      module SingletonMethods
      end
      
      module InstanceMethods
        
        # Override this method to define whether or not a user can add feeds.
        def can_add_feeds?
          false
        end
      end
      
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
muck-services-0.1.47 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.46 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.45 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.44 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.43 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.42 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.41 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.40 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.39 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.38 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.37 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.36 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.35 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.34 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.33 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.32 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.31 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.30 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.29 lib/active_record/acts/muck_feed_owner.rb
muck-services-0.1.28 lib/active_record/acts/muck_feed_owner.rb