I have my layout looking like this :
<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta charset="UTF-8">
<title>My title</title>
<%= stylesheet_link_tag "general" %>
<%= javascript_include_tag "libs/jquery-1.5.1.min" %>
<%= csrf_meta_tag %>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/favicon.ico">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<% if flash[:notice] %>
<% if flash[:notice].kind_of?(Array) %>
<% flash[:notice].each do |id, value| %>
<p><%= id =%> <%= value =%> </p>
<% end %>
<% else %>
<p><%= flash[:notice] =%></p>
<% end %>
<% end %>
<% if flash[:error] %>
<p class="error"><%= flash[:error] %></p>
<% end %>
<!-- more content -->
<div id="principal">
<%= render 'layouts/header' %>
<%= render 'layouts/banner' %>
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>
My problem is this line :
<%= render 'layouts/banner' %>
I have a banner in the top of my website. And i want to change it on each page. How can i overwrite this render from my index.html.erb view of my controller for example?
Thank you for help
Have a look at
content_for. For instance:layout
view