Skip to content

Commit c3cd818

Browse files
committed
feat(search-select-filter-input): adjust to work with association name
1 parent 94de6fb commit c3cd818

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

app/inputs/search_select_filter_input.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ def load_control_attributes
77
end
88

99
def input_method
10-
eq_input_name
10+
"#{input_name}_eq"
11+
end
12+
13+
def input_html_options_name
14+
"#{object_name}[#{input_method}]"
15+
end
16+
17+
def input_value
18+
result = valid_object.conditions.find do |condition|
19+
condition.attributes.map(&:name).include?(input_name.to_s)
20+
end
21+
22+
return unless result
23+
24+
result.values.first.value
1125
end
1226
end

spec/features/inputs/search_select_filter_input_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
context "with initial state" do
1111
before do
1212
register_page(City, false) do
13-
filter :region_id, as: :search_select_filter
13+
filter :region, as: :search_select_filter
1414
end
1515

1616
visit admin_cities_path

0 commit comments

Comments
 (0)