Created
May 18, 2014 02:38
-
-
Save ilake/56bccd4595821177eae8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/views/layouts/application.html.erb | |
<%= render_stylesheets content_for(:stylesheets) %> | |
# app/helpers/layout_helper.rb | |
def render_stylesheets(tag_html = nil) | |
html = [] | |
if tag_html.present? | |
html << tag_html | |
else | |
html << stylesheet_link_tag('application', :media => 'all') | |
html << stylesheet_link_tag(namespace, :media => 'all') | |
end | |
html.join("\n").html_safe | |
end | |
def namespace | |
controller_path.split('/').first | |
end | |
# for special need | |
<% content_for :stylesheets do %> | |
<%= stylesheet_link_tag 'application' %> | |
<%= stylesheet_link_tag 'contact_recordings' %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment