module Mobile module Entities class Project < Grape::Entity expose :name expose :id expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options| current_user = options[:user] can_setting = instance.user_id == current_user.id ? true : false can_setting = false if instance.id.nil? can_setting end expose :member_count, if: lambda { |instance, options| options[:user] } do |instance, options| instance.members.count end end end end