New to Rails and having a hard time envisioning how to proceed with a project. I would like to create a simple page where users:
a) select a “project”, sends to project page
b) from project page, can repeatedly query an API and get results
As I’m still wrapping my head around scaffolding and creating models and controllers, I’m wondering if the following makes sense:
rails generate Project person:string
rails generate API_call title:string response:text
I suppose my question is then, how do I link entries in the API_call table to specific projects? Is this the “references” option?
many thanks in advance…
Your scaffolding command is not correct. For generating complete resource:
This will generate model, controller, migrations, views etc.
For generating just a model:
To list other generators, run
Note: you can use either
gorgeneratorFor relating objects you need to use Associations. Please check this link for getting basic idea http://guides.rubyonrails.org/association_basics.html. If you want to work with it, there is no alternative to study the doc.