Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

render(component:) #6

Closed
cgriego opened this issue May 29, 2019 · 2 comments
Closed

render(component:) #6

cgriego opened this issue May 29, 2019 · 2 comments

Comments

@cgriego
Copy link

cgriego commented May 29, 2019

I personally would be happy with some render(ComponentClass) syntactic sugar, but it seems to me the most Railsy thing to do would be that the formal method be render(component: ComponentClass) in line with the :partial, :template, :inline, :file, :plain, :html, and :body options.

@joelhawksley
Copy link
Member

Good point! This is something we recently considered internally, but decided to wait on until we try to upstream. I wouldn't be surprised if this ended up being the syntax we go with 😄

@joelhawksley
Copy link
Member

Rails 6.1.0.alpha now supports passing an object as the first argument to render: rails/rails#36388.

I've updated this repository and the gem to work with this syntax, passing an instance of the component in.

I actually think the component: syntax is a nicer way to go here, if not a bit verbose. I'm guessing this will come up on rails/rails as we move towards upstreaming the gem for 6.1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants