Module: Feedable::ActsAsFeedable::ClassMethods

Defined in:
lib/feedable/acts_as_feedable.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



86
87
88
89
90
91
92
93
94
# File 'lib/feedable/acts_as_feedable.rb', line 86

def self.extended(base)
  base.after_create :add_created_feed
  base.after_update :add_updated_feed
  base.before_destroy :add_destroyed_feed
  base.after_destroy :destroy_scoped_feeds
  
  base.cattr_accessor :feed_options
  base.has_many :feeds, :as => :feedable
end

Instance Method Details

#create_with_feed(user, *args) ⇒ Object



96
97
98
99
100
# File 'lib/feedable/acts_as_feedable.rb', line 96

def create_with_feed(user, *args)
  options = args.extract_options!
  options.merge!(:feed_initiator_id => user.id)
  return create(options)
end