Where is my data?

I have started a rails application I call 'timecard' using postgresql
as it's back-end.
(rails 3.0.7 on a Suse Linux machine)

I edited the database.yml file to point to the dev prod and test
databases with proper user and password.

I created the basic tables, models etc. using 'rails generate
controller' and 'rails generate scaffold' and 'rake db:migrate' and
everything seems ok.

I started the rails server and pointed firefox at the proper url's and
everything is a go.

Here is where it gets wierd. I just added 4 more records (using the
rails page with Firefox) to a table I originalled added 2 records to
last week. All the records show when I navigate to the proper url.
But when I directly access the table using the postgresql utility
'psql' only the 2 records I added last week are listed! I wanted to
get the key id values of the records, which doesn't show on the
generic rails page, but the records aren't there!

Is some kind of caching going on? I exited Firefox but that didn't
force the records into the table, so what am I seeing in the rails
page, and where is my data?

Thanks in advance for any help. --Fred

I have started a rails application I call 'timecard' using postgresql
as it's back-end.
(rails 3.0.7 on a Suse Linux machine)

I edited the database.yml file to point to the dev prod and test
databases with proper user and password.

I created the basic tables, models etc. using 'rails generate
controller' and 'rails generate scaffold' and 'rake db:migrate' and
everything seems ok.

I started the rails server and pointed firefox at the proper url's and
everything is a go.

Here is where it gets wierd. I just added 4 more records (using the
rails page with Firefox) to a table I originalled added 2 records to
last week. All the records show when I navigate to the proper url.
But when I directly access the table using the postgresql utility
'psql' only the 2 records I added last week are listed! I wanted to
get the key id values of the records, which doesn't show on the
generic rails page, but the records aren't there!

Can you confirm your connecting to the same database from the rails
app and from psql?
Are you sure the index page doesn't have the data harcoded somewhere?
Have you tried copying the database with a different name and change
your app to use the new database?
Do you have your tests in place?

"Can you confirm your connecting to the same database from the rails
app and from psql?"

I started the webrick server in /home/work/timecard so it must be
pointing to the rails timecard app. and the database is specified in
database.yml, beyond that how do I determine the database I am using?

"Are you sure the index page doesn't have the data harcoded somewhere?"

I have opened all of the standard .html.erb files in the app/views/
timeperiods directory and verified there is nothing there beyond the
rails defaults.

"Have you tried copying the database with a different name and change
your app to use the new database?

Not a bad idea so I used psql to clone the database and edited
database.yml in rails to refer to the new database. psql still shows
only 2 records. After restarting the rails server then navigating to
the url I now get "Fatal: database 'mymystery' does not exist".
Edited database.yml back to timecard_development, restarted the rails
server, and the url works again but shows all 6 records. Don't
understand why rails couldn't find my new database 'mymystery'.

It seems clear we are not looking at the same data. I listed all
databases on my (VMWhere virtual) machine, opened and queried them all
with psql, and none of them have the records I added through the rails
interface.

"Do you have your tests in place?"

Actually, no. I guess I'm a slow learner because I do best focusing
on one thing at a time, and for now I want to focus Rails. I will add
what is needed for TDD after I have reached some familiarty with
Rails.

Thanks for looking at my problem, if you think of anything else to try
please comment. --Fred

Please post your complete database.yml

Colin

Mystery solved: the following 2 lines in database.yml were directing
me to another server on our internal network, where the files were
being read from and written to:

host: 198.31.87.25
port: 5432

Now I have to figure out why, after I comment-out the host and port
lines, I get "could not connect to server: no such file or directory"
when I try to access the Rails url's. It's a start!

Thanks everyone for your assistance. --Fred

You have to put the correct host in - localhost possibly

Colin