Class: CouchPotato::Extensions::EncryptedViewSpec

Inherits:
View::ModelViewSpec
  • Object
show all
Defined in:
lib/couch_potato/extensions/encrypted_view_spec.rb

Instance Method Summary collapse

Instance Method Details

#find_and_encrypt_key_attribute(key) ⇒ Object



13
14
15
16
17
# File 'lib/couch_potato/extensions/encrypted_view_spec.rb', line 13

def find_and_encrypt_key_attribute(key)
  property = klass.properties.find{|property| property.name.to_s == options[:key].to_s}
  return key if not property
  property.encrypt(key)
end

#view_parametersObject



5
6
7
8
9
10
11
# File 'lib/couch_potato/extensions/encrypted_view_spec.rb', line 5

def view_parameters
  parameters = super
  if parameters[:key]
    parameters[:key] = find_and_encrypt_key_attribute(parameters[:key])
  end
  parameters
end