Tuesday, 15 March 2011

database - Not sure if my rails application is configured properly for posrtgres db -



database - Not sure if my rails application is configured properly for posrtgres db -

my problem: have setup dev, test environments of rails application utilize postgresql database. how verify ok?

note: beginner on rails , using databases

what i've did verify

i followed railcast migrate default sqlite3 postgresql.

i fired rails console , created user using

user.create(name: "anil bande", email: "anil@gmail.com", password: "foobar", password_confirmation: "foobar")

from output looked user created. verify ran $ user.all while on rails console , output displayed object i'd created in step (2)

now wanted see postgresql prompt. did $psql sample_app_development , there came psql prompt.

i did psql>> \d on psql list tables in database. did , table "users" nowadays in interested in.

now did psql>> select * users , there no results. prompt returned back.

now here confusion. step (6) showing nothing. in rails console looks user created , saved in database. (a) why so? (b) how verify have done setup dev , test environment correct?

i can't comment on rails part, this:

now did psql>> select * users , there no results. prompt returned back.

you forgot end statement ;

you need tell psql when finished typing statement, allowed have statement span more 1 line. note how prompt changed psql=> psql-> indicate psql waiting more.

so if enter

psql=> select * users;

you should fine.

(just clear: psql part of prompt example. real prompt contain name of database connected to. of import thing => , ->)

ruby-on-rails database postgresql ruby-on-rails-3.2

No comments:

Post a Comment