You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a virtual or derived column with the following code:
def view_columns
# Declare strings in this format: ModelName.column_name
# or in aliased_join_table.column_name format
@view_columns ||= {
...
br_baths: { source: 'Property.br_baths', searchable: false },
}
end
def data
records.map do |record|
{
...
br_baths: "#{record.bedrooms} BR/#{record.consolidated_bathrooms} Baths",
}
end
end
The table shows up properly, however the search is broken because the Property.br_baths column does not exist.
This fails with error:
ActiveRecord::StatementInvalid (PG::UndefinedColumn: ERROR: column properties.br_baths does not exist
Is there any way to modify the query that is generated from search or make this field not searchable? I was expecting the searchable: false to prevent this field from being searched but it is not working. I could be mistaken, but I was noticing that there are no tests for searchable: false. It would seem that all the columns are being included in the search. This would be one solution, the other solution is to somehow generate custom SQL for this such that instead of searching br_baths, it was searching bedrooms and bathrooms indepedently.
Thank you for any support and feedback.
The text was updated successfully, but these errors were encountered:
After examining the code, I have my doubts if searchable: false was ever implemented. I couldn't find a test for it. I'm going to take a stab and see what I can do with it.
searchable: false works, I did add more tests to test it and understand its functionality. These tests may be helpful to make sure searchable: false does not regress.
I created a virtual or derived column with the following code:
The table shows up properly, however the search is broken because the
Property.br_baths
column does not exist.This fails with error:
Is there any way to modify the query that is generated from search or make this field not searchable? I was expecting the
searchable: false
to prevent this field from being searched but it is not working. I could be mistaken, but I was noticing that there are no tests forsearchable: false
. It would seem that all the columns are being included in the search. This would be one solution, the other solution is to somehow generate custom SQL for this such that instead of searching br_baths, it was searchingbedrooms
andbathrooms
indepedently.Thank you for any support and feedback.
The text was updated successfully, but these errors were encountered: