Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Rails 5.2 #20032

Closed
38 tasks done
chessbyte opened this issue Mar 31, 2020 · 0 comments · Fixed by #20076
Closed
38 tasks done

Support Rails 5.2 #20032

chessbyte opened this issue Mar 31, 2020 · 0 comments · Fixed by #20076
Assignees
Milestone

Comments

@chessbyte
Copy link
Member

chessbyte commented Mar 31, 2020

Labeled rail5.2 if applicable and jansa/yes? OR already in jansa branch:

Not needed

@chessbyte chessbyte added this to the Jansa milestone Mar 31, 2020
jrafanie added a commit to jrafanie/manageiq-providers-openstack that referenced this issue Apr 8, 2020
Fixes more strict rails 5.2 error:

```
     ActiveRecord::AssociationNotFoundError:
       Association named 'parent' was not found on ManageIQ::Providers::Openstack::CloudManager::Vm; perhaps you misspelled it?
     # ./app/models/manageiq/providers/openstack/inventory/collector/target_collection.rb:388:in `infer_related_vm_ems_refs_db!'
     # ./app/models/manageiq/providers/openstack/inventory/collector/target_collection.rb:297:in `infer_related_ems_refs!'
     # ./app/models/manageiq/providers/openstack/inventory/collector/target_collection.rb:8:in `initialize'
```

Related to ManageIQ/manageiq#20032

```
irb(main):001:0> ManageIQ::Providers::CloudManager::Vm._reflect_on_association(:key_pairs)
=> #<ActiveRecord::Reflection::ThroughReflection:0x00007f9a48b414c0...
irb(main):002:0> ManageIQ::Providers::CloudManager::Vm._reflect_on_association(:network_ports)
=> #<ActiveRecord::Reflection::HasManyReflection:0x00007f9a3daab4d0...
irb(main):003:0> ManageIQ::Providers::CloudManager::Vm._reflect_on_association(:floating_ips)
=> #<ActiveRecord::Reflection::HasManyReflection:0x00007f9a3dad0758...
irb(main):004:0> ManageIQ::Providers::CloudManager::Vm._reflect_on_association(:orchestration_stack)
=> #<ActiveRecord::Reflection::BelongsToReflection:0x00007f9a3daa1408...
irb(main):005:0> ManageIQ::Providers::CloudManager::Vm._reflect_on_association(:cloud_networks)
=> #<ActiveRecord::Reflection::ThroughReflection:0x00007f9a3dab9170...
irb(main):006:0> ManageIQ::Providers::CloudManager::Vm._reflect_on_association(:cloud_tenant)
=> #<ActiveRecord::Reflection::BelongsToReflection:0x00007f9a469739b0...
irb(main):007:0> ManageIQ::Providers::CloudManager::Vm._reflect_on_association(:parent)
=> nil
```
jrafanie added a commit to jrafanie/manageiq-providers-openstack that referenced this issue Apr 8, 2020
Fixes an error seen in rails 5.2 because it's more strict about validating
`includes` are associations:

```
     ActiveRecord::AssociationNotFoundError:
       Association named 'parent' was not found on ManageIQ::Providers::Openstack::CloudManager::Vm; perhaps you misspelled it?
     # ./app/models/manageiq/providers/openstack/inventory/collector/target_collection.rb:388:in `infer_related_vm_ems_refs_db!'
     # ./app/models/manageiq/providers/openstack/inventory/collector/target_collection.rb:297:in `infer_related_ems_refs!'
     # ./app/models/manageiq/providers/openstack/inventory/collector/target_collection.rb:8:in `initialize'
```

Related to ManageIQ/manageiq#20032

Below, you can see all of the other "included" values is an association that can
be reflected on by the model, while :parent cannot.  Note, this was the case
with rails 5.1 and it must have silently discarded these bogus includes while
5.2 raises `ActiveRecord::AssociationNotFoundError`.

```
irb(main):001:0> vm_klass = ManageIQ::Providers::CloudManager::Vm
irb(main):002:0> vm_klass._reflect_on_association(:key_pairs)
irb(main):003:0> vm_klass._reflect_on_association(:network_ports)
irb(main):004:0> vm_klass._reflect_on_association(:floating_ips)
irb(main):005:0> vm_klass._reflect_on_association(:orchestration_stack)
irb(main):006:0> vm_klass._reflect_on_association(:cloud_networks)
irb(main):007:0> vm_klass._reflect_on_association(:cloud_tenant)
irb(main):008:0> vm_klass._reflect_on_association(:parent)
```
jrafanie pushed a commit to jrafanie/manageiq-schema that referenced this issue Apr 28, 2020
jrafanie added a commit to jrafanie/manageiq that referenced this issue Apr 30, 2020
jrafanie added a commit to jrafanie/manageiq-api that referenced this issue Apr 30, 2020
Rails 5.2 raises this error if you try to persist the child before creating the
parent: `Failed to create new custom button - You cannot call create unless the
parent is saved`

Followup to ManageIQ#814
Needed for Rails 5.2: ManageIQ/manageiq#20032
d-m-u added a commit to d-m-u/manageiq-api that referenced this issue Apr 30, 2020
    Rails 5.2 raises this error if you try to persist the child before creating the
    parent: `Failed to create new custom button - You cannot call create unless the
    parent is saved`

    Followup to ManageIQ#814
    Needed for Rails 5.2: ManageIQ/manageiq#20032
    thanks keenan and lj
jrafanie pushed a commit to jrafanie/manageiq-schema that referenced this issue Apr 30, 2020
jrafanie pushed a commit to jrafanie/manageiq-schema that referenced this issue May 1, 2020
jrafanie added a commit to jrafanie/manageiq that referenced this issue May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Jansa
Development

Successfully merging a pull request may close this issue.

3 participants