<body>
<h1>Main Title</h1>
<P>Up until this point, the HTML's coming from the application
layout.</p>
<%= @content_for_layout %>
</body>
</html>
which renders fine but without a stylesheet tag in the HTML. If I
change the stylesheet tag to -
<%= stylesheet_link_tag "main", "blog", :media => "all" %> or even
<%= stylesheet_link_tag "main" %>
- then I get an exception raised -
wrong number of arguments (2 for 0)
I have a number of options for working around this, but I'd like to
understand where I'm going wrong. Anyone care to enlighten me? TIA.
I just pulled this from my working template:
<%= stylesheet_link_tag 'style' %>
the only difference I can see is you used double quotes, I'm on
singles, see if that helps. I guess its not rendering a style tag
because you haven't passed it any parameters like name etc...
Im still learning myself so I may be wrong, but you never know!
Nope, still getting the exception. I've got a stack trace which points
me at the method which is throwing the exception. I guess I'm going to
have to dig around in the code and see if I can work it out.
Nope, still getting the exception. I've got a stack trace which points
me at the method which is throwing the exception. I guess I'm going to
have to dig around in the code and see if I can work it out.
Do you get the same exception when <%= title_tag %> is removed?
which renders fine but without a stylesheet tag in the HTML. If I
change the stylesheet tag to -
<%= stylesheet_link_tag "main", "blog", :media => "all" %> or even
<%= stylesheet_link_tag "main" %>
- then I get an exception raised -
wrong number of arguments (2 for 0)
I have a number of options for working around this, but I'd like to
understand where I'm going wrong. Anyone care to enlighten me? TIA.
stylesheet_link_tag with no parameters appears to be an error according to the comments in the helper method that handles this tag. Your last option should work, though (with just "main" as a parameter). You *do* have a css file called "main.css" in your public/stylesheets directory, right?
You could also try:
<%= stylesheet_link_tag :all %>
...which is supposed to make style link tags for all the .css files in your stylesheets directory.
Ah, cracked it. I had a helper method named stylesheet_tag in
application_helper.rb. This was clashing with the identically named
method in action_view/helpers/asset_tag_helper.rb.