Closed lahirisan closed 4 years ago
hi everybody: Im trying to use ransack sorting feature with 2 different db connections, using many to many relation between my models I have 3 models with this relation among them:
class SqlServerIncidente < ApplicationRecord establish_connection :sql_server self.table_name_prefix = "Alto.dbo." self.table_name = 'Incidente' has_many :sql_server_incidente_linkages, foreign_key: "sql_server_incidente_id" has_many :linkages, :through => :sql_server_incidente_linkages end
class Linkage < ApplicationRecord has_many :sql_server_incidente_linkages, dependent: :destroy has_many :sql_server_incidentes, :through => :sql_server_incidente_linkages end
class SqlServerIncidenteLinkage < ApplicationRecord belongs_to :linkage belongs_to :sql_server_incidente end
In rails console i can do this successfully: SqlServerIncidente.first.sql_server_incidente_linkages.first.linkage.name
SqlServerIncidente.first.sql_server_incidente_linkages.first.linkage.name
but when a try to ransack sorting throw the field name associated to Linkage model using the previous defined relation i get this error:
(TinyTds::Error: Invalid object name'sql_server_incidente_linkages'.
it is like rails do not recognize the relation among MS SQLServer and Mysql when sorting
Any Idea? anybody???
Sorry by my english. Im spanish speaker Thanks
Thanks @lahirisan
SQLServer is not supported by Ransack.
hi everybody: Im trying to use ransack sorting feature with 2 different db connections, using many to many relation between my models I have 3 models with this relation among them:
class SqlServerIncidente < ApplicationRecord establish_connection :sql_server self.table_name_prefix = "Alto.dbo." self.table_name = 'Incidente' has_many :sql_server_incidente_linkages, foreign_key: "sql_server_incidente_id" has_many :linkages, :through => :sql_server_incidente_linkages end
class Linkage < ApplicationRecord has_many :sql_server_incidente_linkages, dependent: :destroy has_many :sql_server_incidentes, :through => :sql_server_incidente_linkages end
class SqlServerIncidenteLinkage < ApplicationRecord belongs_to :linkage belongs_to :sql_server_incidente end
In rails console i can do this successfully:
SqlServerIncidente.first.sql_server_incidente_linkages.first.linkage.name
but when a try to ransack sorting throw the field name associated to Linkage model using the previous defined relation i get this error:
(TinyTds::Error: Invalid object name'sql_server_incidente_linkages'.
it is like rails do not recognize the relation among MS SQLServer and Mysql when sorting
Any Idea? anybody???
Sorry by my english. Im spanish speaker Thanks