Skip to content

revisions and versions array is empty in Rails 4 vs. Rails 3 #2269

Open
@BMahabir

Description

@BMahabir

Expected behavior vs actual behavior

We have several failures that have popped up in our unit-test cases (rspec) after upgrading to Rails 4, largely related to the revisions and versions array being empty during execution that would previously have had no issues during Rails 3 execution and testing. Here is an example of one for versions :

Failure/Error: risk1.versions.last.update_attribute(:created_at, Date.today - 1.day)
NoMethodError:
undefined method `update_attribute' for nil:NilClass

and a couple for revisions :

  1. Failure/Error: expect(revisions.length).to eq(6) Now @josevalim can stop to fight with textile #1 model, 5 associations
    expected: 6
    got: 0
    (compared using ==)

  2. Failure/Error: revisions = cause["revisions"]
    NoMethodError:
    undefined method `[]' for nil:NilClass

I'm aware these are not very descriptive -- but this is because the ONLY change in circumstance is Rails 4 vs. Rails 3. We have tried many different things and are convinced that only two things could be the issue : this gem, or the paper_trail gem (of which we tried several different versions and there was no change).

Steps to reproduce

(e.g., detailed walkthrough, runnable script, example application)

We simply ran our test suite in Rails 4 which now have a bunch of failures vs. Rails 3 which did not have these failures.

Environment

ActiveModelSerializers Version (commit ref if not on tag):

0.8.4 (although also tried upgrading to 0.10.x and the exact same issue persisted).

Output of ruby -e "puts RUBY_DESCRIPTION":

ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]

OS Type & Version:

Windows 10 (but we deploy on CentOS, which we have also tested and the exact same failures result)

Integrated application and version (e.g., Rails, Grape, etc):

Backtrace

(e.g., provide any applicable backtraces from your application)

Additonal helpful information

(e.g., Gemfile.lock, configurations, PR containing a failing test, git bisect results)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions