What I had to do was:
First I followed the steps specified by @Alex Siri.
But after doing that using
rake db:migrate
Did not add the values question,answer etc to the table, so I did the following steps
I again deleted the scaffold using the command
rails destroy scaffold level
After that I again created the scaffold using the command:
rails generate scaffold level question:string answer:string prev_q:integer next_q:integer
Finally I ran migration using
rake db:migrate
This solved my problem. I wrote all the steps so that if anyone else has the same problem then they can easily solve it.