I want to query a view from ActiveRecord instead of a regular table. Also, the view reside in a different database, i am using octopus gem to access the other database, but the issue is i am unable to query the views.
I tried something like this
class ViewExportDataWell < ExternalRecord
self.table_name = 'ViewExportDataWells' //this is my view name
end
and trying to access it as
ViewExportDataWell.ransack(params[:q]).result
but this works for a regular table and not a view. Any leads on how I can achieve this would be great, Thanks.
you need to connect the model to their corresponding database
For more info about establish_connection go to https://apidock.com/rails/ActiveRecord/Base/establish_connection/class