Suppose I have a ruby hash :
person={:name=>:Alex,:age=>10}
I wish I could call an API like this:
db.save :people, person
which will execute the following SQL on mysql database:
insert nto people (name,age) values ('Alex',10)
Is this possible by using rails or other ruby gems?
You can call ClassName.create!(your_hash), so in your scenario it would look like this:
or
No need to use any external gems, this is standard ActiveRecord, one of the Rails core libraries.