Skip to content

Conversation

@briri
Copy link
Contributor

@briri briri commented Jun 15, 2017

Rails' asset pipeline cannot handle 'let' when precompiling assets. Switched all instances to 'var'

@briri briri merged commit cabe91c into DMPRoadmap:CDL-MVP Jun 15, 2017
johnpinto1 pushed a commit to DigitalCurationCentre/roadmap that referenced this pull request May 25, 2021
…dmin rights in

    their organisation has their organisation changed the user retained the
    Org Admin rights (when they should have been deleted).

    The attribute_changed? callback has been removed in Rails 5.2, so we
    need to use saved_change_to_attribute?.

    So in our case, we replaced :org_id_changed? with :saved_change_to_org_id? in the after_update callbacks in the User model:

after_update :clear_department_id, if: :saved_change_to_org_id?

  after_update :delete_perms!, if: :saved_change_to_org_id?, unless: :can_change_org?

  after_update :remove_token!, if: :saved_change_to_org_id?, unless: :can_change_org?

The following tests in spec/models/user_spec.rb were replacements:

it "destroys user perms" do
   expect(user.perms.count).to eql(0)
end

it "resets api_token to be nil" do
    expect(user.api_token).to be_nil
end
portagenetwork referenced this pull request in portagenetwork/roadmap Feb 24, 2022
…s in

    their organisation has their organisation changed the user retained the
    Org Admin rights (when they should have been deleted).

    The attribute_changed? callback has been removed in Rails 5.2, so we
    need to use saved_change_to_attribute?.

    So in our case, we replaced :org_id_changed? with :saved_change_to_org_id? in the after_update callbacks in the User model:

after_update :clear_department_id, if: :saved_change_to_org_id?

  after_update :delete_perms!, if: :saved_change_to_org_id?, unless: :can_change_org?

  after_update :remove_token!, if: :saved_change_to_org_id?, unless: :can_change_org?

The following tests in spec/models/user_spec.rb were replacements:

it "destroys user perms" do
   expect(user.perms.count).to eql(0)
end

it "resets api_token to be nil" do
    expect(user.api_token).to be_nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant