1 module CommonApiTemplate
2 def self.included(base)
5 alias_method :as_api_response_orig, :as_api_response
6 include InstanceMethods
8 base.extend(ClassMethods)
9 base.api_accessible :common do |t|
16 t.add :modified_by_client_uuid
17 t.add :modified_by_user_uuid
22 module InstanceMethods
23 # choose template based on opts[:for_user]
24 def as_api_response(template=nil, opts={})
26 user = opts[:for_user] || current_user
27 if user.andand.is_admin and self.respond_to? :api_accessible_superuser
33 self.as_api_response_orig(template, opts)