Sha256: 072265ec8a22f633d9b379b62e80db0584b984eccd4496e763ef70ebdd1dcc7d

Contents?: true

Size: 512 Bytes

Versions: 2

Compression:

Stored size: 512 Bytes

Contents

module Tasuku
  module Taskables
    class Code::Response < ActiveRecord::Base
      include Taskable::Submission

      belongs_to :request
      belongs_to :author, polymorphic: true

      validates :author_id, :author_type, presence: true
      validates :code, presence: true
      validate :code_is_valid

      request is: :request

      private

      def code_is_valid
        errors.add :code, I18n.t('tasuku.taskables.codes.responses.invalid') unless code == request.code
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tasuku-1.1.0 app/models/tasuku/taskables/code/response.rb
tasuku-1.0.1 app/models/tasuku/taskables/code/response.rb