> SHOW FIELDS FROM projects;
+-------------+--------------+------+-----+---------+----------------+
> Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
> id | int(11) | NO | PRI | NULL | auto_increment |
> users_id | int(11) | YES | MUL | NULL | |
> title | varchar(255) | YES | | NULL | |
> description | text | YES | | NULL | |
> created_at | datetime | NO | | NULL | |
> updated_at | datetime | NO | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)
My question is.
Why my application don't find my table ?
Are you sure you are connected to the correct database?
Are you running in development or production mode?
What happens if you do
rails console
Project.first
I made a rake db:migrate VERSION=0 and again a rake db:migrate.
So I put what you say to me do:
1.9.3-p0 :002 > Product.first
NameError: uninitialized constant Product
from (irb):2
from
/home/felipe/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/console.rb:47:in
`start'
from
/home/felipe/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/console.rb:8:in
`start'
from
/home/felipe/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:41:in
`<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
That is ok then, the table is there but empty. Now what are you
getting from the app? Show us the full error.
By the way it is easier to follow the thread (particularly for those
who find the thread later) if you insert your reply into the previous
post rather than posting at the top.
Can you post the terminal output when you start the server and then go
to that page (right from the command that starts the server).
By the way it is easier to follow the thread (particularly for those
who find the thread later) if you insert your reply into the previous
post rather than posting at the top.
Man, I don't understand, but I reset my server, and refresh my page and
go OK.
Are you sure the server was running in development mode previously,
and not production?
On a separate issue, if you want project belongs_to user then you
should have said t.references :user (not :users) and the column should
be user_id not users_id.
I don't know whether I mentioned it previously but it is easier to
follow the thread (particularly for those who find the thread later)
if you insert your reply into the previous post rather than posting at
the top.