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
When I execute request GET /api/rest/admin/routing/destinations?sort=country.name app crashes because the country relationship does not belong to the destination directly but through network_prefix (see code sniped below).
class Routing::Destination < ApplicationRecord
belongs_to :network_prefix, class_name: 'System::NetworkPrefix', optional: true
has_one :country, through: :network_prefix
end
class Api::Rest::Admin::Routing::DestinationResource < ::BaseResource
has_one :country, class_name: 'Country', force_routed: true, foreign_key_on: :related
end
I suggest overriding the sort_records class method to perform such sorting
Additional info
backtrace error when executing a request with sorting by country.name
SELECT "class4"."destinations".* FROM "class4"."destinations"
LEFT JOIN sys.countries AS country_sorting ON country_sorting.id = class4.destinations.country_id
LEFT JOIN class4.rate_groups AS rate_group_sorting ON rate_group_sorting.id = class4.destinations.rate_group_id
ORDER BY country_sorting.name asc, rate_group_sorting.name asc LIMIT $1 OFFSET $2 [["LIMIT", 50], ["OFFSET", 0]]
Internal Server Error: PG::UndefinedColumn: ERROR: column destinations.country_id does not exist
LINE 1: ...ntries AS country_sorting ON country_sorting.id = class4.des...
^
The text was updated successfully, but these errors were encountered:
Description
When I execute request
GET /api/rest/admin/routing/destinations?sort=country.name
app crashes because the country relationship does not belong to the destination directly but through network_prefix (see code sniped below).I suggest overriding the
sort_records
class method to perform such sortingAdditional info
backtrace error when executing a request with sorting by country.name
The text was updated successfully, but these errors were encountered: