last saved record not retrieving .

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 ?

Code below

######## controller code

class AdminUsersController < ApplicationController

def new

@admin = AdminUser.new

end

def index

@admins = AdminUser.all

end

def create

@admin = AdminUser.new(params[:admin_user])

if @admin.save

redirect_to admin_users_path

else

render “new”

end

end

end

######## new view############

<%= form_for @admin do|f|%>

First Name

<%= f.text_field :first_name%>

<%= submit_tag"Create"%>

<% end %>

######## index view############

<%= @admins%>

##############model

nothing in model

Hope you all understand the problem .

Thanks

Regards

Fahim Babar Patel

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 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

Thanks

>
> 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.

Colin

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

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 ?

>
>
>>
>> >
>> > 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.

Colin

#######################Gem file.lock################################

GEM

remote: https://rubygems.org/

specs:

RedCloth (4.2.9)

actionmailer (3.2.4)

actionpack (= 3.2.4)

mail (~> 2.4.4)

actionpack (3.2.4)

activemodel (= 3.2.4)

activesupport (= 3.2.4)

builder (~> 3.0.0)

erubis (~> 2.7.0)

journey (~> 1.0.1)

rack (~> 1.4.0)

rack-cache (~> 1.2)

rack-test (~> 0.6.1)

sprockets (~> 2.1.3)

activemodel (3.2.4)

activesupport (= 3.2.4)

builder (~> 3.0.0)

activerecord (3.2.4)

activemodel (= 3.2.4)

activesupport (= 3.2.4)

arel (~> 3.0.2)

tzinfo (~> 0.3.29)

activeresource (3.2.4)

activemodel (= 3.2.4)

activesupport (= 3.2.4)

activesupport (3.2.4)

i18n (~> 0.6)

multi_json (~> 1.0)

acts-as-taggable-on (2.3.3)

rails (~> 3.0)

addressable (2.3.2)

albino (1.3.3)

posix-spawn (>= 0.3.6)

ansi (1.4.3)

arel (3.0.2)

bcrypt-ruby (3.0.1)

blogit (0.5.0)

RedCloth (>= 4.2.9)

acts-as-taggable-on (>= 2.2.1)

albino (>= 1.3.3)

jquery-rails

kaminari (>= 0.13.0)

nokogiri (>= 1.5.0)

redcarpet (>= 2.0.1)

builder (3.0.4)

cancan (1.6.8)

capybara (1.1.3)

mime-types (>= 1.16)

nokogiri (>= 1.3.3)

rack (>= 1.0.0)

rack-test (>= 0.5.4)

selenium-webdriver (~> 2.0)

xpath (~> 0.1.4)

childprocess (0.3.6)

ffi (~> 1.0, >= 1.0.6)

chronic (0.6.7)

chunky_png (1.2.6)

client_side_validations (3.2.1)

coderay (1.0.8)

coffee-rails (3.2.2)

coffee-script (>= 2.2.0)

railties (~> 3.2.0)

coffee-script (2.2.0)

coffee-script-source

execjs

coffee-script-source (1.4.0)

compass (0.12.2)

chunky_png (~> 1.2)

fssm (>= 0.2.7)

sass (~> 3.1)

compass-rails (1.0.3)

compass (>= 0.12.2, < 0.14)

cucumber (1.2.1)

builder (>= 2.1.2)

diff-lcs (>= 1.1.3)

gherkin (~> 2.11.0)

json (>= 1.4.6)

cucumber-rails (1.3.0)

capybara (>= 1.1.2)

cucumber (>= 1.1.8)

nokogiri (>= 1.5.0)

database_cleaner (0.9.1)

diff-lcs (1.1.3)

em-websocket (0.3.8)

addressable (>= 2.1.1)

eventmachine (>= 0.12.9)

email_spec (1.4.0)

launchy (~> 2.1)

mail (~> 2.2)

erubis (2.7.0)

eventmachine (1.0.0)

execjs (1.4.0)

multi_json (~> 1.0)

factory_girl (4.1.0)

activesupport (>= 3.0.0)

factory_girl_generator (0.0.3)

factory_girl_rails (4.1.0)

factory_girl (~> 4.1.0)

railties (>= 3.0.0)

ffaker (1.15.0)

ffi (1.1.5)

friendly_id (4.0.9)

fssm (0.2.9)

gherkin (2.11.5)

json (>= 1.4.6)

growl (1.0.3)

guard (1.5.3)

listen (>= 0.4.2)

lumberjack (>= 1.0.2)

pry (>= 0.9.10)

thor (>= 0.14.6)

guard-livereload (1.1.0)

em-websocket (>= 0.2.0)

guard (>= 1.5.0)

multi_json (~> 1.0)

guard-rspec (2.1.1)

guard (>= 1.1)

rspec (~> 2.11)

hike (1.2.1)

hirb (0.7.0)

i18n (0.6.1)

journey (1.0.4)

jquery-rails (2.1.3)

railties (>= 3.1.0, < 5.0)

thor (~> 0.14)

json (1.7.5)

kaminari (0.14.1)

actionpack (>= 3.0.0)

activesupport (>= 3.0.0)

launchy (2.1.2)

addressable (~> 2.3)

libv8 (3.3.10.4)

libwebsocket (0.1.5)

addressable

listen (0.5.3)

lumberjack (1.0.2)

mail (2.4.4)

i18n (>= 0.4.0)

mime-types (~> 1.16)

treetop (~> 1.4.8)

method_source (0.8.1)

mime-types (1.19)

mini_magick (3.4)

subexec (~> 0.2.1)

minitest (4.2.0)

multi_json (1.3.7)

nokogiri (1.5.5)

pg (0.14.1)

pg_search (0.5.7)

activerecord (>= 3)

activesupport (>= 3)

polyglot (0.3.3)

posix-spawn (0.3.6)

pry (0.9.10)

coderay (~> 1.0.5)

method_source (~> 0.8)

slop (~> 3.3.1)

rack (1.4.1)

rack-cache (1.2)

rack (>= 0.4)

rack-ssl (1.3.2)

rack

rack-test (0.6.2)

rack (>= 1.0)

rails (3.2.4)

actionmailer (= 3.2.4)

actionpack (= 3.2.4)

activerecord (= 3.2.4)

activeresource (= 3.2.4)

activesupport (= 3.2.4)

bundler (~> 1.0)

railties (= 3.2.4)

rails3-jquery-autocomplete (1.0.10)

rails (~> 3.0)

railties (3.2.4)

actionpack (= 3.2.4)

activesupport (= 3.2.4)

rack-ssl (~> 1.3.2)

rake (>= 0.8.7)

rdoc (~> 3.4)

thor (>= 0.14.6, < 2.0)

rake (0.9.2.2)

rb-readline (0.4.2)

rdoc (3.12)

json (~> 1.4)

recaptcha (0.3.4)

redcarpet (2.2.2)

rspec (2.11.0)

rspec-core (~> 2.11.0)

rspec-expectations (~> 2.11.0)

rspec-mocks (~> 2.11.0)

rspec-core (2.11.1)

rspec-expectations (2.11.3)

diff-lcs (~> 1.1.3)

rspec-mocks (2.11.3)

rspec-rails (2.11.4)

actionpack (>= 3.0)

activesupport (>= 3.0)

railties (>= 3.0)

rspec (~> 2.11.0)

rubyzip (0.9.9)

sass (3.2.2)

sass-rails (3.2.5)

railties (~> 3.2.0)

sass (>= 3.1.10)

tilt (~> 1.3)

selenium-webdriver (2.26.0)

childprocess (>= 0.2.5)

libwebsocket (~> 0.1.3)

multi_json (~> 1.0)

rubyzip

shoulda-matchers (1.4.1)

activesupport (>= 3.0.0)

simplecov (0.7.1)

multi_json (~> 1.0)

simplecov-html (~> 0.7.1)

simplecov-html (0.7.1)

sitemap_generator (3.4)

builder

slop (3.3.3)

sprockets (2.1.3)

hike (~> 1.2)

rack (~> 1.0)

tilt (~> 1.1, != 1.3.0)

subexec (0.2.2)

therubyracer (0.10.2)

libv8 (~> 3.3.10)

thor (0.16.0)

tilt (1.3.3)

treetop (1.4.12)

polyglot

polyglot (>= 0.3.1)

turn (0.9.6)

ansi

tzinfo (0.3.34)

uglifier (1.3.0)

execjs (>= 0.3.0)

multi_json (~> 1.0, >= 1.0.2)

whenever (0.7.3)

activesupport (>= 2.3.4)

chronic (~> 0.6.3)

wicked (0.3.0)

activesupport (>= 3.0.7)

rails (>= 3.0.7)

xpath (0.1.4)

nokogiri (~> 1.3)

PLATFORMS

ruby

DEPENDENCIES

bcrypt-ruby

blogit

cancan

capybara

client_side_validations

coffee-rails (~> 3.2.1)

compass-rails

cucumber-rails

database_cleaner

email_spec

execjs

factory_girl

factory_girl_generator

factory_girl_rails

ffaker

friendly_id (~> 4.0.1)

growl

guard-livereload

guard-rspec

hirb

jquery-rails

launchy

mini_magick

minitest

pg

pg_search

pry

rails (= 3.2.4)

rails3-jquery-autocomplete

rb-readline

recaptcha

rspec-rails

sass-rails (~> 3.2.3)

selenium-webdriver

shoulda-matchers

simplecov

sitemap_generator

therubyracer

turn

uglifier (>= 1.0.3)

whenever

wicked

OS - Ubunto 11.10

Ruby version - ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

Raills Version - rails 3.2.4

###################database yml###################3

PostgreSQL. Versions 8.2 and up are supported.

All that looks ok to me, I am out of ideas. Anyone else?

Colin

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

index page.

But not after creation ?

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

fahim patel wrote in post #1082938:

You’re missing a respond_to do format block

You realise you are five years late responding to this problem.

Colin

Oh sorry I originally responded by mistake, i must have found the thread searching Then that put it in my list