Module: Auth::Concerns::OwnerConcern::ClassMethods

Defined in:
app/models/auth/concerns/owner_concern.rb

Instance Method Summary collapse

Instance Method Details

#find_self(_id, resource, options = {}) ⇒ Object

used in cart_item_controller_concern#show if the resource is nil, will look for a cart item, which has a resource of nil, otherwise will look for a cart item, with the provided resource id.



51
52
53
54
55
56
57
58
59
60
61
# File 'app/models/auth/concerns/owner_concern.rb', line 51

def find_self(_id,resource,options={})
	conditions = {:_id => _id}
	conditions[:resource_id] = resource.id.to_s if !resource.is_admin?
	#puts "conditions are:"
	#puts conditions.to_s
	all = self.where(conditions)
	#puts "the resultant size:"
	#puts all.size.to_s
	return all.first if all.size > 0 
	return nil
end