language.rb revision 5b9d1e25142d3712e05d5df39d5b0d5dc3c0212f
fb0951b02ebf51a93acf12721d8857d31ce57ba3Lennart Poetteringclass Language < ActiveRecord::Base
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering include Resourcable
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering include Permissionable
3e2147858f21943d5f4a781c60f33ac22c6096edKay Sievers
3e2147858f21943d5f4a781c60f33ac22c6096edKay Sievers has_many :supports
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering has_many :language_adjoints
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering has_many :ontologies
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering has_many :serializations
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering belongs_to :user
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering attr_accessible :name, :iri, :description, :standardization_status, :defined_by
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering validates :name, length: { minimum: 1 }
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering validates :iri, length: { minimum: 1 }
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering validates_uniqueness_of :iri, if: :iri_changed?
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering validates_format_of :iri, with: URI::regexp(ALLOWED_URI_SCHEMAS)
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering
4e949c11a1df4547d5f102e4131e07b026369cd7Javier Jardón def to_s
4e949c11a1df4547d5f102e4131e07b026369cd7Javier Jardón name
4e949c11a1df4547d5f102e4131e07b026369cd7Javier Jardón end
3b5b000fbc2ed6d953df2de528a50a8348afc618Lennart Poettering
4e949c11a1df4547d5f102e4131e07b026369cd7Javier Jardón def addLogic(logic)
4e949c11a1df4547d5f102e4131e07b026369cd7Javier Jardón sup = self.supports.new
4e949c11a1df4547d5f102e4131e07b026369cd7Javier Jardón sup.logic = logic
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering sup.save!
78a825f216d39ee0295b00647b059d45467e1d02Kay Sievers end
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poetteringend
47be870bd83fb3719dffc3ee9348a409ab762a14Lennart Poettering