znamenica/dneslov

View on GitHub
app/models/memory_name.rb

Summary

Maintainability
A
0 mins
Test Coverage
B
81%
class MemoryName < ActiveRecord::Base
   belongs_to :memory
   belongs_to :nomen
   belongs_to :state, primary_key: :key, foreign_key: :state_code, class_name: :Subject

   enum mode: [ :ored, :prefix ]

   accepts_nested_attributes_for :nomen, reject_if: :all_blank

   validates_presence_of :memory, :nomen, :state

   def to_s
      nomen.text
   end
end