I am also referring to Active Record's rdoc but am not able to make
how to use the insert statement in the above code. Can anyone help
using INSERT statement in my code above?
Well if you've got activerecord model classes then you'd just create
instances of those.
If not ActiveRecord::Base.connection.insert will execute the chunk of
sql you give it.