I have the following code, which works fine with no errors but the models never get saved...
myarray.each do |item|
r = MyModel.unscoped.where(:site_id => @site.id, :url => item['permalink_url']).first_or_initialize do |r|
r.title = 'asdasdadaddjfgnfd'
r.save!
end
end
Terminal shows the SQL SELECT statements when attempting to find the Models, but the UPDATE/INSERT statements never run.
What am I missing here?
.tap()
so i could use my existing block structure but this is also a valid answer – Topless