1 class Arvados::V1::LinksController < ApplicationController
4 if resource_attrs[:head_kind] and ArvadosModel::resource_class_for_uuid(resource_attrs[:head_uuid]).kind != resource_attrs[:head_kind]
5 errors.add(attr, "'#{resource_attrs[:head_kind]}' does not match '#{head_uuid}'")
8 if resource_attrs[:tail_kind] and ArvadosModel::resource_class_for_uuid(resource_attrs[:tail_uuid]).kind != resource_attrs[:tail_kind]
9 errors.add(attr, "'#{resource_attrs[:tail_kind]}' does not match '#{tail_uuid}'")
12 resource_attrs.delete :head_kind
13 resource_attrs.delete :tail_kind
19 # Overrides ApplicationController load_where_param
23 # head_kind and tail_kind columns are now virtual,
24 # equivilent functionality is now provided by
25 # 'is_a', so fix up any old-style 'where' clauses.
29 @filters << ['head_uuid', 'is_a', @where[:head_kind]]
30 @where.delete :head_kind
33 @filters << ['tail_uuid', 'is_a', @where[:tail_kind]]
34 @where.delete :tail_kind
39 # Overrides ApplicationController load_filters_param
40 def load_filters_param
43 # head_kind and tail_kind columns are now virtual,
44 # equivilent functionality is now provided by
45 # 'is_a', so fix up any old-style 'filter' clauses.
46 @filters = @filters.map do |k|
47 if k[0] == 'head_kind' and k[1] == '='
48 ['head_uuid', 'is_a', k[2]]
49 elsif k[0] == 'tail_kind' and k[1] == '='
50 ['tail_uuid', 'is_a', k[2]]