controller instance variables do not get reloaded #6575

Closed
andyvb opened this Issue May 31, 2012 · 7 comments

Projects

None yet

3 participants

@andyvb
andyvb commented May 31, 2012

This is an issue with Rails 3.2.4 (works fine in Rails 3.2.3)

  1. create a new rails app
rails new rails_3_2_4
cd rails_3_2_4
rails g scaffold foo name:string
rake db:migrate
rails s -e development
  1. go to /foos and create a new Foo record
  2. go back to /foos

Result:
The new Foo records is not listed. If you restart the server, it is now listed. But if you create a new Foo record, it is not listed again until you restart the server.

Expected Result:
The new Foo record should be listed.

@rafaelfranca
Member

Could you provide an example application? This behavior is well tested and I don't think that this is a Rails bug.

@andyvb
andyvb commented May 31, 2012

Agreed seems crazy. Here is the sample app:

https://github.com/andyvb/rails_3_2_4_example

@pixeltrix
Member

@andyvb I've tried your steps and everything works okay with 3.2.4 on my computer

@rafaelfranca
Member

@pixeltrix seems this is the same issue that #6576.

@pixeltrix
Member

@andyvb @rafaelfranca it's a duplicate of #6576 - the cached Model.all is not been invalidated.

@pixeltrix
Member

Snap 😄

@andyvb
andyvb commented May 31, 2012

@pixeltrix, @rafaelfranca thanks guys, I thought I was going crazy. Seems pretty serious.

@pixeltrix pixeltrix added a commit that closed this issue Jun 1, 2012
@pixeltrix pixeltrix Restore behavior of Active Record 3.2.3 scopes
A series of commits relating to preloading and scopes caused a regression.
Cloning the relation calls initialize_copy which resets a number of instance
variables to nil. Without this the scope thinks that it is already loaded
when it is called again.

Reverts the following commits:
13f1401
8491740
dffbb52

Fixes #6575, #6576 & #6577
7056079
@pixeltrix pixeltrix closed this in 7056079 Jun 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment