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

ArgumentError when rendering a partial from a Phlex::Rails::Layout #196

Closed
joeldrapper opened this issue Apr 17, 2024 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@joeldrapper
Copy link
Collaborator

joeldrapper commented Apr 17, 2024

Hi!

I like this change. I needed something like this in the past.

However, it appears to have broken this kind of code:

class ApplicationLayout < Phlex::HTML
  include Phlex::Rails::Layout

  def view_template
    html do
      body do
        render partial: "tracking" # boom
      end
    end
  end
end

It raises:

     ArgumentError:
       wrong number of arguments (given 0, expected 1+)
     # /Users/kim/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/phlex-rails-1.2.1/lib/phlex/rails/layout.rb:48:in `render'

Originally posted by @Burgestrand in #192 (comment)

@joeldrapper joeldrapper added the bug Something isn't working label Apr 17, 2024
@Burgestrand
Copy link
Contributor

Worth mentioning is that in this particular case I could fix it by changing to render "tracking", and that this might in some way be related to #137?

@joeldrapper
Copy link
Collaborator Author

This should have been covered by the if @_context check, which is essentially saying, “if we’re already rendering something, do the usual behaviour”. It’s because Rails interface for layouts is that they should respond to render, while everything else needs to respond to render_in. So frustrating. 😅

joeldrapper added a commit that referenced this issue Sep 12, 2024
@joeldrapper
Copy link
Collaborator Author

This is fixed in main and v1. It will be in the next release.

@Burgestrand
Copy link
Contributor

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants