File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,13 +7,13 @@ def index
77 @documents = current_user . documents . order ( document_date : :desc )
88
99 if ( !params [ :folder_filter ] . blank? )
10- @documents = @documents . where ( ' folder_id' , params [ :folder_filter ] )
10+ @documents = @documents . select { | d | d . folder_id == convert_to_int ( params [ :folder_filter ] ) }
1111 end
1212 if ( !params [ :state_filter ] . blank? )
13- @documents = @documents . where ( ' state_id' , params [ :state_filter ] )
13+ @documents = @documents . select { | d | d . state_id == convert_to_int ( params [ :state_filter ] ) }
1414 end
1515 if ( !params [ :person_filter ] . blank? )
16- @documents = @documents . where ( ' person_id' , params [ :person_filter ] )
16+ @documents = @documents . select { | d | d . person_id == convert_to_int ( params [ :person_filter ] ) }
1717 end
1818
1919 json_response ( @documents )
@@ -88,6 +88,11 @@ def destroy
8888
8989 private
9090
91+ def convert_to_int ( string )
92+ num = string . to_i
93+ num if num . to_s == string
94+ end
95+
9196 def set_document
9297 @document = Document . find ( params [ :id ] )
9398 end
You can’t perform that action at this time.
0 commit comments