topic and synapse validate permission
This commit is contained in:
parent
cf6411988d
commit
c4be57e525
2 changed files with 6 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue