Skip to content

Update lock/unlock snippet#781

Merged
Fryguy merged 1 commit intoManageIQ:masterfrom
stiwa-uejo:Update-Contributing-guideline
Feb 4, 2026
Merged

Update lock/unlock snippet#781
Fryguy merged 1 commit intoManageIQ:masterfrom
stiwa-uejo:Update-Contributing-guideline

Conversation

@stiwa-uejo
Copy link
Contributor

when running in rails console i get

vmdb(dev)> MiqAeDomain.find_by_name("ManageIQ").update_attributes(:source => "user")
  MiqAeDomain Load (0.5ms)  SELECT "miq_ae_namespaces".* FROM "miq_ae_namespaces" WHERE "miq_ae_namespaces"."ancestry" IS NULL AND "miq_ae_namespaces"."name" != '$' AND "miq_ae_namespaces"."name" = $1 LIMIT $2  [["name", "ManageIQ"], ["LIMIT", 1]]
  MiqAeDomain Inst Including Associations (0.1ms - 1rows)
activemodel (8.0.4) lib/active_model/attribute_methods.rb:512:in `method_missing': undefined method `update_attributes' for an instance of MiqAeDomain (NoMethodError)
Did you mean?  update_attribute

and when using attributes it expects 2 arguments

vmdb(dev)> MiqAeDomain.find_by_name("ManageIQ").update_attribute(:source => "user")
  MiqAeDomain Load (0.5ms)  SELECT "miq_ae_namespaces".* FROM "miq_ae_namespaces" WHERE "miq_ae_namespaces"."ancestry" IS NULL AND "miq_ae_namespaces"."name" != '$' AND "miq_ae_namespaces"."name" = $1 LIMIT $2  [["name", "ManageIQ"], ["LIMIT", 1]]
  MiqAeDomain Inst Including Associations (0.1ms - 1rows)
activerecord (8.0.4) lib/active_record/persistence.rb:530:in `update_attribute': wrong number of arguments (given 1, expected 2) (ArgumentError)

using update_attribute without hash rocket worked

vmdb(dev)> MiqAeDomain.find_by_name("ManageIQ").update_attribute(:source, "system")
  MiqAeDomain Load (0.5ms)  SELECT "miq_ae_namespaces".* FROM "miq_ae_namespaces" WHERE "miq_ae_namespaces"."ancestry" IS NULL AND "miq_ae_namespaces"."name" != '$' AND "miq_ae_namespaces"."name" = $1 LIMIT $2  [["name", "ManageIQ"], ["LIMIT", 1]]
  MiqAeDomain Inst Including Associations (0.1ms - 1rows)
=> true

@miq-bot add-label bug

@miq-bot miq-bot added the bug label Feb 4, 2026
@miq-bot
Copy link
Member

miq-bot commented Feb 4, 2026

Checked commit stiwa-uejo@9948f25 with ruby 3.3.10, rubocop 1.56.3, haml-lint 0.69.0, and yamllint
0 files checked, 0 offenses detected
Everything looks fine. 🏆

Copy link
Member

@Fryguy Fryguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The other option is renaming update_attributes to just update, but this works too.

@Fryguy Fryguy self-assigned this Feb 4, 2026
@Fryguy Fryguy merged commit c9e1ca7 into ManageIQ:master Feb 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments