diff --git a/app/models/synapse.rb b/app/models/synapse.rb index 943c8635..225485e5 100644 --- a/app/models/synapse.rb +++ b/app/models/synapse.rb @@ -10,6 +10,9 @@ class Synapse < ActiveRecord::Base validates :desc, length: { minimum: 0, allow_nil: false } + validates :permission, presence: true + validates :permission, inclusion: { in: Perm::ISSIONS.map(&:to_s) } + def user_name self.user.name end diff --git a/app/models/topic.rb b/app/models/topic.rb index 6f694868..e80d3df7 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -10,6 +10,9 @@ class Topic < ActiveRecord::Base has_many :mappings, as: :mappable, dependent: :destroy has_many :maps, :through => :mappings + + validates :permission, presence: true + validates :permission, inclusion: { in: Perm::ISSIONS.map(&:to_s) } # This method associates the attribute ":image" with a file attachment has_attached_file :image