app/models/commontator/comment.rb in commontator-4.11.1 vs app/models/commontator/comment.rb in commontator-5.0.0

- old
+ new

@@ -1,19 +1,19 @@ module Commontator class Comment < ActiveRecord::Base - belongs_to :creator, :polymorphic => true - belongs_to :editor, :polymorphic => true + belongs_to :creator, polymorphic: true + belongs_to :editor, polymorphic: true, optional: true belongs_to :thread - validates_presence_of :creator, :on => :create - validates_presence_of :editor, :on => :update + validates_presence_of :creator, on: :create + validates_presence_of :editor, on: :update validates_presence_of :thread validates_presence_of :body validates_uniqueness_of :body, - :scope => [:creator_type, :creator_id, :thread_id, :deleted_at], - :message => I18n.t('commontator.comment.errors.double_posted') + scope: [:creator_type, :creator_id, :thread_id, :deleted_at], + message: I18n.t('commontator.comment.errors.double_posted') protected cattr_accessor :acts_as_votable_initialized @@ -34,11 +34,11 @@ self.class.acts_as_votable_initialized = true end def get_vote_by(user) return nil unless is_votable? && !user.nil? && user.is_commontator - votes_for.where(:voter_type => user.class.name, :voter_id => user.id).first + votes_for.where(voter_type: user.class.name, voter_id: user.id).first end def update_cached_votes(vote_scope = nil) self.update_column(:cached_votes_up, count_votes_up(true)) self.update_column(:cached_votes_down, count_votes_down(true)) @@ -62,16 +62,16 @@ self.save end def created_timestamp I18n.t 'commontator.comment.status.created_at', - :created_at => I18n.l(created_at, :format => :commontator) + created_at: I18n.l(created_at, format: :commontator) end - + def updated_timestamp I18n.t 'commontator.comment.status.updated_at', - :editor_name => Commontator.commontator_name(editor || creator), - :updated_at => I18n.l(updated_at, :format => :commontator) + editor_name: Commontator.commontator_name(editor || creator), + updated_at: I18n.l(updated_at, format: :commontator) end ################## # Access Control # ##################