>
> Hi all,
>
>
> from last 1 hour i am facing one problem.
>
> I have written a code for creating user and show them in index page
> after
> save.
>
> Code is working perfectly but on index page i am getting all record till
> second last record saved, but i am not getting current record which is
> saved.
>
> But in database my last record is saved successful.
>
>
> But when i restart the server , than on index page all record come with
> the
> last record .
>
> I dont know why this all is happening ?
Have a look at the Rails Guide on debugging, it will show you
techniques that you can use to debug your code.
Colin
Hi Colin,
Thanks for reply.
I use pry.
I Debug the good , when i use binding.pry my index object select all records
but when i remove binding.pry and start to create new record than same issue
i am facing.
Last record is not coming
Then use some of the other techniques of debugging - insert debug code
to print information about what is going on in the console for
example. Print @admins.count for example in the controller index
action to try and tie down where the problem lies. The first thing to
determine is whether it the view is not displaying the last record or
whether @admins does not include all the records.
Are you using the latest version of the database gem? What is it?
Look in Gemfile.lock to find out.
>
>
>>
>> >
>> > Hi all,
>> >
>> >
>> > from last 1 hour i am facing one problem.
>> >
>> > I have written a code for creating user and show them in index page
>> > after
>> > save.
>> >
>> > Code is working perfectly but on index page i am getting all record
>> > till
>> > second last record saved, but i am not getting current record which
>> > is
>> > saved.
>> >
>> > But in database my last record is saved successful.
>> >
>> >
>> > But when i restart the server , than on index page all record come
>> > with
>> > the
>> > last record .
>> >
>> > I dont know why this all is happening ?
>>
>> Have a look at the Rails Guide on debugging, it will show you
>> techniques that you can use to debug your code.
>>
>> Colin
>
>
> Hi Colin,
>
> Thanks for reply.
> I use pry.
> I Debug the good , when i use binding.pry my index object select all
> records
>
> but when i remove binding.pry and start to create new record than same
> issue
> i am facing.
>
> Last record is not coming
Then use some of the other techniques of debugging - insert debug code
to print information about what is going on in the console for
example. Print @admins.count for example in the controller index
action to try and tie down where the problem lies. The first thing to
determine is whether it the view is not displaying the last record or
whether @admins does not include all the records.
Are you using the latest version of the database gem? What is it?
Look in Gemfile.lock to find out.
I puts @admins.count it give me correct counting on controller and when i
pass the object
to index view same thing is happening .
I am using Postgres and as you say i will delete Gemfile.lock and run the
bundle.
Hope for the best
Colin
Hi Colin,
Still facing a problem. Table count giving me accurate counting ,
but
@admins = AdminUser.all
give me records till last restart server.
I don't know why this all is happening ?
I asked what gem you are using for database access, you have not told
us. Possibly best to post Gemfile, Gemfile.lock and databsae.yml
here. Also tell us which version of ruby and which version of rails
and which operating system you are using.
Also please do not send me a copy of your emails, just send it to the
list. I do not need two copies. Thanks.
I try to use sleep in index action controller before and after , but it also not work.
One thing i notice is that after some time or restart server when,refresh the page, all acurate object come on
I try to use sleep in index action controller before and after , but it also not work.
One thing i notice is that after some time or , restart server all acurate object come on
index page.
After some time means when i work on other page which is not of same model and controller.
Still but i have to restart the server for AdminUser module.
Dont know y this all is happening only with AdminUser module, other MVC module are working perfectly