Search code examples
ruby-on-railsrubyprimary-keytabularscaffold

Do I Generate a :primary_key to Create Headers in Table?


Rails g scaffold Quantified {type:string (i.e. average or instance) name:string metric:string} result:decimal date:date

Do I use a :primary_key to help generate the below table? I put the main components in the above brackets.

I want the bracketed data types to be the headers of the table, then whenever a user submits a new _form that includes an existing type, name, & metric (i.e. primary_keys?) then the _form would add a new column reflecting the result & date to the preexisting row.

enter image description here

Here's what a similar table looks like live on my blog: http://www.anthonygalli.com/quantify/


Solution

  • No :primary_key was needed I used scope in the rb file instead.