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

can not call method with args including keyword inside attribute/extra_attribute #444

Open
yanghoxom opened this issue Dec 23, 2022 · 0 comments

Comments

@yanghoxom
Copy link

my environment:
Ruby 3.1.3
Rails 7.0.4
Graphiti 1.3.9
Graphiti-rails 0.4.0

I faced this issue

extra_attribute :attribute_name, :array do
  get_my_age(@object, date: Date.current)
end

def get_my_age(birth, date:)
end

it will throw ArgumentError (wrong number of arguments (given 2, expected 1; required keyword: date)):

but, if I try with

extra_attribute :attribute_name, :array do
  wrapper(@object, Date.current)
end

def wrapper(a, b)
  get_my_age(a, date: b)
end

def get_my_age(birth, date:)
end

it will not throw any errors.

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

No branches or pull requests

1 participant