Sha256: cb9c7651def11deae59984bae251d941a208050c17e0ce23f4fd355c63b2d5f2

Contents?: true

Size: 698 Bytes

Versions: 5

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true

class Spree::FeedbackReview < ApplicationRecord
  belongs_to :user, class_name: Spree.user_class.to_s, optional: true

  belongs_to :review, touch: true
  validates :review, presence: true

  validates :rating, numericality: { only_integer: true,
                                     greater_than_or_equal_to: 1,
                                     less_than_or_equal_to: 5,
                                     message: :you_must_enter_value_for_rating }

  scope :most_recent_first, -> { order("spree_feedback_reviews.created_at DESC") }
  default_scope { most_recent_first }

  scope :localized, lambda { |lc| where('spree_feedback_reviews.locale = ?', lc) }
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_reviews-1.7.0 app/models/spree/feedback_review.rb
solidus_reviews-1.6.0 app/models/spree/feedback_review.rb
solidus_reviews-1.5.0 app/models/spree/feedback_review.rb
solidus_reviews-1.4.1 app/models/spree/feedback_review.rb
solidus_reviews-1.4.0 app/models/spree/feedback_review.rb