I’m learning Rails and it’s going well so far. My biggest question at the moment is: how do I go about manually inserting a row into my database? I’ve got the scaffolding in place for creating rows of DataTypeOne, but I want a row for DataTypeTwo to be created when the form for DataTypeOne is submitted (and have it reference the id of DataTypeOne…but I think I can work this out on my own).
Thanks in advance.
You create rows in your database by creating and saving new ActiveRecord Objects (your models).
So in your controller code you could create a new row of DataTypeTwo by doing