app/models/c80_estate/area.rb in c80_estate-0.1.0.19 vs app/models/c80_estate/area.rb in c80_estate-0.1.0.20

- old
+ new

@@ -106,10 +106,16 @@ C80Estate::Area.joins(:item_props) .where(c80_estate_item_props: {prop_name_id: 5}) .where(c80_estate_item_props: {value: v}) end + def self.where_assigned_person_id(id) + # Rails.logger.debug "\t\t [2]: v = #{v}" + C80Estate::Area.joins(:property) + .where(:c80_estate_properties => {assigned_person_id: id}) + end + def self.import_excel(file) Rails.logger.debug "------------------------------------------------------------- self.import [BEGIN] " import_result = '' @@ -282,9 +288,17 @@ end ransacker :item_prop_floor_val, formatter: proc { |v| results = C80Estate::Area.where_floor(v).map(&:id) + results = results.present? ? results : nil + }, splat_params: true do |parent| + parent.table[:id] + end + + ransacker :assigned_person_id, + formatter: proc { |v| + results = C80Estate::Area.where_assigned_person_id(v).map(&:id) results = results.present? ? results : nil }, splat_params: true do |parent| parent.table[:id] end \ No newline at end of file