Trying to insert a ruby hash into a Postgres Database -


i have created hash scraped xml data have retrieved web. next task insert data postgresql database each key different column, , have drawn blank. appreciated. in advance.

temp = @ttc.css('vehicle').map |vehicle|  {     id: vehicle.attributes["id"].value,     routetag: vehicle.attributes["routetag"].value,     lat: vehicle.attributes["lat"].value,     lon: vehicle.attributes["lon"].value }  end 

provided model name vehicle , vehicles table has columns named id, routetag, lat, lon, solution simple this:

@new_vehicle = vehicle.create(temp) 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -