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

Cast level argument of console_log action always to string #24

Merged
merged 7 commits into from
Feb 26, 2023

Conversation

marcoroth
Copy link
Owner

This pull request fixes a bug where passing the level argument to the console_log action as a Symbol it would unnecessarily escape the value of the Symbol.

So a call like:

turbo_stream.console_log("Message", :error)

Would end up in:

<turbo-stream message="Message" level="&quot;error&quot;" action="console_log"></turbo-stream>

With this pull request the <turbo-stream> gets correctly generated as:

<turbo-stream message="Message" level="error" action="console_log"></turbo-stream>

This pull request also enhances the console_log action to be provided via kwargs instead of just regular positional arguments. Additionally, this is now also valid:

turbo_stream.console_log(message: "Message")
turbo_stream.console_log("Message", level: :log)
turbo_stream.console_log(message: "Message", level: :log)
turbo_stream.console_log(level: :log, message: "Message")

@marcoroth marcoroth merged commit a71e49b into main Feb 26, 2023
@marcoroth marcoroth deleted the fix-console-log-level branch February 26, 2023 03:49
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.

None yet

1 participant