Sha256: 94c067b394cf0350cd137d72de28af0499c2e2587b3281d195ba3d6d58c95045

Contents?: true

Size: 579 Bytes

Versions: 1

Compression:

Stored size: 579 Bytes

Contents

module SeemsRateable
  module Helpers
    module ActionViewExtension
      def rating_for(rateable, options={})
        unless rateable.kind_of? Models::ActiveRecordExtension::Rateable
          raise Errors::InvalidRateableError, "#{rateable.inspect} is not a rateable" +
            " object, try adding 'seems_rateable' into your object's model"
        end

        if !current_rater || rateable.rated_by?(current_rater, options[:dimension])
          options[:disabled] = true
        end

        SeemsRateable::Builder.build(rateable, options)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seems_rateable-2.0.0 lib/seems_rateable/helpers/action_view_extension.rb