Sha256: 32325f3a94d495e4738f02b3814a6dca5fc23e1101d5275bd2df81e839aca334

Contents?: true

Size: 505 Bytes

Versions: 5

Compression:

Stored size: 505 Bytes

Contents

module HasVcards
  class DirectoryLookupController < ApplicationController
    def search
      @selector = params[:selector]
      vcard_params = extract_vcard_params(params, @selector)

      @vcard = Vcard.new(vcard_params)
      render 'vcards/directory_lookup'
    end

    private

    def extract_vcard_params(params, selector)
      keys = selector.delete(']').split('[')
      vcard_params = params
      keys.each { |key| vcard_params = vcard_params[key] }

      vcard_params
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
has_vcards-1.1.2 app/controllers/has_vcards/directory_lookup_controller.rb
has_vcards-1.1.1 app/controllers/has_vcards/directory_lookup_controller.rb
has_vcards-1.1.0 app/controllers/has_vcards/directory_lookup_controller.rb
has_vcards-1.0.0 app/controllers/has_vcards/directory_lookup_controller.rb
has_vcards-1.0.0.rc0 app/controllers/has_vcards/directory_lookup_controller.rb