lib/parole.rb in parole-0.0.1 vs lib/parole.rb in parole-0.1

- old
+ new

@@ -1,4 +1,26 @@ require 'parole/version' -module Parole +require 'active_record' +require 'active_support' + +require 'parole/commentable' +require 'parole/comment' + +class ActiveRecord::Base + def self.acts_as_commentable(options = {}) + class_attribute :commentable_options, :acts_as_commentable + self.acts_as_commentable = true + self.commentable_options = options.reverse_merge(roles: []) + self.commentable_options[:roles] = commentable_options[:roles].map(&:to_s) + + include Parole::Commentable + end + + def self.acts_as_commentable? + !!self.acts_as_commentable + end + + def self.acts_as_comment(*args) + include Parole::Comment + end end