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
23 module InstanceMethods
24 # choose template based on opts[:for_user]
25 def as_api_response(template=nil, opts={})
27 user = opts[:for_user] || current_user
28 if user.andand.is_admin and self.respond_to? :api_accessible_superuser
34 self.as_api_response_orig(template, opts)