Class: Medium

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Authorization, Taxonomix
Defined in:
app/models/medium.rb

Constant Summary collapse

VALID_NFS_PATH =

We need to include $ in this as $arch, $release, can be in this string

/^([-\w\d\.]+):(\/[\w\d\/\$\.]+)$/

Instance Method Summary collapse

Methods included from Taxonomix

included

Methods included from Authorization

#enforce_create_permissions, #enforce_destroy_permissions, #enforce_edit_permissions, #enforce_permissions, included, #permission_failed?

Instance Method Details

#as_json(options = {}) ⇒ Object


35
36
37
38
# File 'app/models/medium.rb', line 35

def as_json(options={})
  options ||= {}
  super({:only => [:name, :id]}.merge(options))
end

#image_path=(path) ⇒ Object

Write the image path, with a trailing “/” if required


57
58
59
# File 'app/models/medium.rb', line 57

def image_path= path
  write_attribute :image_path, "#{path}#{"/" unless path =~ /\/$|^$/}"
end

#jumpstart_dirObject


52
53
54
# File 'app/models/medium.rb', line 52

def jumpstart_dir
  config_path.match(VALID_NFS_PATH)[2]
end

#jumpstart_hostObject


44
45
46
# File 'app/models/medium.rb', line 44

def jumpstart_host
  config_path.match(VALID_NFS_PATH)[1]
end

#media_dirObject


48
49
50
# File 'app/models/medium.rb', line 48

def media_dir
  media_path.match(VALID_NFS_PATH)[2]
end

#media_hostObject


40
41
42
# File 'app/models/medium.rb', line 40

def media_host
  media_path.match(VALID_NFS_PATH)[1]
end