Revision 7a481d2d
Added by Jochen Schalanda about 14 years ago
- ID 7a481d2df8548ebb0651f38331877fbad901a3f3
app/models/media.rb | ||
---|---|---|
validates_uniqueness_of :path, :scope => :operatingsystem_id
|
||
validates_presence_of :name, :path
|
||
validates_format_of :name, :with => /\A(\S+\s?)+\Z/, :message => "can't be blank or contain trailing white spaces."
|
||
validates_format_of :path, :with => /^((http|ftp):\/\/)|\w+:\/\w+/,
|
||
:message => "Url (http:// or ftp://) or a NFS share area allowed (e.g. server:/vol/dir)"
|
||
validates_format_of :path, :with => /^(http|https|ftp|nfs):\/\//,
|
||
:message => "Only URLs with schema http://, https://, ftp:// or nfs:// are allowed (e.g. nfs://server/vol/dir)"
|
||
|
||
alias_attribute :os, :operatingsystem
|
||
before_destroy Ensure_not_used_by.new(:hosts)
|
Also available in: Unified diff
fixes #235 - Small refactoring of the media handling for operating system families: * Use URI class for any URI related operations * Added substitution for $version, $major and $minor in media path * Force use of http(s)|ftp|nfs URI schema: NFS shares have now to be entered in URI form: nfs://server/path/.../ instead of server:/path/.../