Assets in the head?

All the examples I see, AWDWR, the forums, have the use of
“stylesheet_link_tag” in the section of the template.
Similarly for javascript.

But if my template is including partials for actions, those action might
require a stylesheet or javascript that is specific only to them.

For example, the tinyMCE javascript isn’t needed in index or show or
delete, but is needed in edit.

Is there way in the action-specific partial to specify an asset tag
that somehow magically gets rendered in the ?


The state can’t give you free speech, and the state can’t take it away.
You’re born with it, like your eyes, like your ears. Freedom is
something you assume, then you wait for someone to try to take it away.
The degree to which you resist is the degree to which you are free…
–Utah Phillips

Is there way in the action-specific partial to specify an asset tag
that somehow magically gets rendered in the ?

Yes, assuming those partials render with the layout (not by themselves
via
ajax say).

layout:

<%= yield :headstuff %> ...

partial:

blah blah

<% content_for ‘headstuff’ do %>
this will end up in the head…
<% end %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs