Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
到目前为止,我通过 RestClient 从网站中提取了一组哈希值:
def self.all_galleries JSON.parse(RestClient.get ENV["GALLERY_API"], {:accept => :json}) end
然后我想将此数组传递给我的控制器,并为每个哈希创建一个新对象并将其保存到我的数据库中,前提是它不存在而不使用任何形式的形式。这样做最干净的方法是什么?