Cross Reference: ontology_version.rb
xref
: /
lxc
/
doc
/
pom.xml
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
ontology_version.rb revision 0772cf7b22adf46dbab68e829d6a2cd8e8d1bc2a
class
OntologyVersion
<
ActiveRecord
::
Base
include
OntologyVersion
::
Parsing
belongs_to
:
user
belongs_to
:
ontology
, :
counter_cache
=> :
versions_count
mount_uploader
:
raw_file
,
OntologyUploader
mount_uploader
:
xml_file
,
OntologyUploader
attr_accessible
:
raw_file
, :
remote_raw_file_url
validate
:
validates_size_of_raw_file
, :
if
=> :
raw_file
?
scope
:
latest
,
order
(
'id DESC'
)
before_create
:
set_source_uri
def
set_source_uri
self.source
_uri
=
self.remote
_raw_file_url
end
protected
def
validates_size_of_raw_file
if
raw_file.size
>
10.megabytes.to
_i
errors.add
:
raw_file
,
'Maximum upload size is 10M.'
end
end
end