Skip to content

add rudimentary support for rendering components from controllers#235

Merged
joelhawksley merged 2 commits into
masterfrom
38-components-in-controllers
Mar 2, 2020
Merged

add rudimentary support for rendering components from controllers#235
joelhawksley merged 2 commits into
masterfrom
38-components-in-controllers

Conversation

@joelhawksley
Copy link
Copy Markdown
Member

This change introduces the ability to render components from
controllers, mimicking the behavior introduced in
rails/rails#37919.

[Fixes: #38]

This change introduces the ability to render components from
controllers, mimicking the behavior introduced in
rails/rails#37919.

[Fixes: #38]
inline_response = response.body

assert_equal baseline_response, inline_response
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wouldn't this be a little better as two tests. I'd like to see a test saying "we didn't break regular rendering with our monkey patch" I think that's what you mean by baseline.

Copy link
Copy Markdown
Contributor

@jonspalmer jonspalmer left a comment

Choose a reason for hiding this comment

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

I like it. We have a bunch of places where we'd use this.

@joelhawksley
Copy link
Copy Markdown
Member Author

@jonspalmer right now, this just renders the component without a layout, matching the behavior of rendering partials from controllers.

Is that the behavior you'd expect? Or would you expect layouts to work?

@jonspalmer
Copy link
Copy Markdown
Contributor

I think without layouts is what I'd expect. Otherwise you'd get double rendered layouts or the like. I'd need to go review the examples in more detail.

@joelhawksley joelhawksley merged commit 29e8f88 into master Mar 2, 2020
@joelhawksley joelhawksley deleted the 38-components-in-controllers branch March 2, 2020 16:55
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.

Allow rendering components in the controller

2 participants