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

[bug] Cryptic error on render when fields have both symbol and string names #480

Open
1 of 2 tasks
branson-simplethread opened this issue Oct 25, 2024 · 1 comment
Open
1 of 2 tasks
Assignees
Labels
bug An issue with the system good first issue Good for newcomers

Comments

@branson-simplethread
Copy link

branson-simplethread commented Oct 25, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Is this a regression?

  • Yes, this used to work before

Current Behavior

Title pretty much says it all. If a blueprint has both a field with a symbol name and a field with a string name, render raises an ArgumentError:

ArgumentError: comparison of Symbol with String failed
from .../blueprinter-1.1.2/lib/blueprinter/view_collection.rb:32:in `sort_by'

Expected Behavior

Blueprinter handles this case and does not raise an error, or raises a more descriptive error.

Steps To Reproduce

Minimal test case:

class Test < Blueprinter::Base
  field(:foo) { 1 }
  field('bar') { 2 }
end

Test.render nil

Environment

- Ruby 3.1.6
- Blueprinter 1.1.2

Anything else?

No response

@branson-simplethread branson-simplethread added the bug An issue with the system label Oct 25, 2024
@lessthanjacob lessthanjacob added the good first issue Good for newcomers label Oct 29, 2024
@lessthanjacob
Copy link
Contributor

Thanks for reporting this @branson-simplethread! We'll look into getting a fix out for this shortly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue with the system good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants