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

raise if helpers called from #initialize #228

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Vagab
Copy link
Contributor

@Vagab Vagab commented Sep 14, 2024

resolves #220

return super unless ActiveRecord::Relation === renderable
when nil
partial = kwargs.delete(:partial)
when Phlex::SGML, Proc, Method, String
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ran rubocop -A here. Let me know if I should roll this change back

def helpers
raise HelpersCalledBeforeRenderError.new("Do not use rails helpers until after the view has been rendered.") unless @_view_context
Copy link
Contributor Author

@Vagab Vagab Sep 14, 2024

Choose a reason for hiding this comment

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

alternatively I think we could move this to helper_macros.rb. But I think it's better to leave it here. Wdyt?

@Vagab
Copy link
Contributor Author

Vagab commented Sep 30, 2024

@joeldrapper ping

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.

We should raise an error if you try to use a helper from an initializer
2 participants