Sha256: 8ea33570fd04e7e3874cd0a76420cf44c77937636c1693b2799038174ffa65a9

Contents?: true

Size: 425 Bytes

Versions: 6

Compression:

Stored size: 425 Bytes

Contents

module ActsAsCommentableMore
  module Helpers
    module Post
      module ScopesHelper

        def define_all_comments_scope comment_name, commentable
          redefine_method("all_#{comment_name.to_s}") do
            comment_model
            .includes(commentable.to_sym, :user)
            .where(commentable.to_sym => self)
            .order(created_at: :desc)
          end
        end


      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
acts_as_commentable_more-1.2.5 lib/acts_as_commentable_more/helpers/post/scopes_helper.rb
acts_as_commentable_more-1.2.4 lib/acts_as_commentable_more/helpers/post/scopes_helper.rb
acts_as_commentable_more-1.2.3 lib/acts_as_commentable_more/helpers/post/scopes_helper.rb
acts_as_commentable_more-1.2.2 lib/acts_as_commentable_more/helpers/post/scopes_helper.rb
acts_as_commentable_more-1.2.1 lib/acts_as_commentable_more/helpers/post/scopes_helper.rb
acts_as_commentable_more-1.2.0 lib/acts_as_commentable_more/helpers/post/scopes_helper.rb