app/models/c80_estate/owner.rb in c80_estate-0.1.0.9 vs app/models/c80_estate/owner.rb in c80_estate-0.1.0.10

- old
+ new

@@ -72,19 +72,25 @@ end def can_edit_area?(area) r1 = roles.where(role_type: 1) # mark_is_owner = area.owner.id == id - mark_is_assigned = area.assigned_person.id == id + mark_is_assigned = false + if area.property.assigned_person.present? + mark_is_assigned = area.property.assigned_person.id == id + end r1.count > 0 || mark_is_assigned # || mark_is_owner # true end def can_edit_property?(property) r1 = roles.where(role_type: 1) # mark_is_owner = property.owner.id == id - mark_is_assigned = property.assigned_person.id == id + mark_is_assigned = false + if property.assigned_person.present? + mark_is_assigned = property.assigned_person.id == id + end r1.count > 0 || mark_is_assigned # || mark_is_owner # true end def can_create_areas? \ No newline at end of file