Reputation: 7121
I want to create TODO List application.
So I want to create an admin page, and a worker page.
In order to do that, I need two controllers:
rails generate controller Admins
rails generate controller Workers
now, I want to create two tables and use them in the controllers:
first table will be the workers: email (string), full_name (text), is_worker (boolean).
second table will be the connection: email_admin(string), email_worker(string), task(text), done (boolean).
how should I define the tables?
I tried:
rails generate scaffold workers email: string, full_name: text, is_worker: boolean
rake db:migrate
rails generate scaffold connection email_admin: string, email_worker: string, task: text, done: boolean
rake db:migrate
but it defines me controllers of: "workers" and "connection", and I don't want to create controllers, but just tables. (and then I will use the tables in the controllers of: Admins and Workers)
Upvotes: 2
Views: 842
Reputation: 15089
Use rails generate model worker
and rails generate model connection
. This command will create two models and its correspondent tables.
Upvotes: 2