From 30ec73f8fa9eea025711bd9594058df88af249f7 Mon Sep 17 00:00:00 2001 From: "veaceslav.solotchi@4finance.com" Date: Tue, 22 Aug 2017 11:05:22 +0200 Subject: [PATCH] performance improvement --- lib/acts_as_api/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/acts_as_api/base.rb b/lib/acts_as_api/base.rb index e704c7a..5cff5c8 100644 --- a/lib/acts_as_api/base.rb +++ b/lib/acts_as_api/base.rb @@ -29,12 +29,12 @@ def acts_as_api? #:nodoc: # *Note*: There is only whitelisting for api accessible attributes. # So once the model acts as api, you have to determine all attributes here that should # be contained in the api responses. - def api_accessible(api_template, options = {}, &block) + def api_accessible(api_template, options = {}) attributes = api_accessible_attributes(api_template).try(:dup) || ApiTemplate.new(api_template) attributes.merge!(api_accessible_attributes(options[:extend])) if options[:extend] if block_given? - yield attributes + Proc.new.call attributes end class_attribute "api_accessible_#{api_template}".to_sym