How can I use SQL Server Table Views as Rails Models (Read Only)?

南笙酒味 提交于 2019-12-06 14:22:22

So I found that I needed to specify a primary key for the table. So here is the addition I made.

class Game < IncomingModel
  self.table_name = 'games'
  self.primary_key = 'game_id', 'this_other_column'
end

I also had to incorporate for my needs the gem composite_primary_keys, however, that might be more than what some developers will need. Thanks to anyone that took the time to try and help troubleshoot this issue!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!