database - Viewing seed results in rails console -
database - Viewing seed results in rails console -
i have created seed file, ran rake db:migrate
, rake db:seed
seemed have run fine. however, view seeds in rails console, name of table usersinfo
. how view verify seeds populated correctly in console?
i have tried usersinfo.all
in console got next error.
undefined method `all'
as far know, cannot straight view tables rails console, can check if table has info via associated activerecord model of table
ex:
if table name usersinfo
should have model called
class userinfo < activerecord::base set_table_name :usersinfo end
and in console
userinfo.all
note: per rails convention, table name should plural, if not using rails convention, set table name via set_table_name:
method
and also, .all
activerecord
class methods , works activerecord model
ruby-on-rails database testing seeding
Comments
Post a Comment