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

What's the best way use/render partials? #127

Closed
brunozrk opened this issue Dec 3, 2014 · 4 comments
Closed

What's the best way use/render partials? #127

brunozrk opened this issue Dec 3, 2014 · 4 comments

Comments

@brunozrk
Copy link

brunozrk commented Dec 3, 2014

What's the best way to use/render partials?

render partial: 'partial_name'
render 'partial_name'

And with variables

render 'partial_name', locals: { var: 'something' }
render 'partial_name', var: 'something'

Sorry if it is a stupid question

@brunozrk brunozrk changed the title Render partials What's the best way to use partials? Dec 3, 2014
@brunozrk brunozrk changed the title What's the best way to use partials? What's the best way use/renderuse partials? Dec 3, 2014
@brunozrk brunozrk changed the title What's the best way use/renderuse partials? What's the best way use/render partials? Dec 3, 2014
@toao
Copy link
Contributor

toao commented Dec 9, 2014

Hi,
prefer the short form if possible, that means:

render 'foo'

and

render 'foo', bar: 'baz'

@brunozrk
Copy link
Author

brunozrk commented Jan 7, 2015

👍

@cesc1989
Copy link

Whenever I want to render a partial yielding a collection or an object, I need to specify the partial: word argument:

<%= render partial: 'partial_name', collection: @collection %>

If not, an exception is raised.

@onebree
Copy link

onebree commented Oct 23, 2015

@cesc1989 yes, I get the same thing as well. I think this should be explained in the guide, or at least noted somewhere

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

No branches or pull requests

4 participants