Displaying 20 results from an estimated 1000 matches similar to: "Purpose of ''yield'' in layout file in Flickr video?"
2006 Jan 23
8
yield vs @content_for_layout, etc..
I am relatively new to RoR and Ruby for that matter.   A few questions 
for the pros:
Question 1:
In the 5min ajax video the presenter uses
<%= yield %> in his layout.
In the agile book, @content_for_layout is used.
Since, yield is an actual Ruby construct, is it more efficient and 
preferred?  What is the difference?
Question 2:
Links are often of the form  :action =>
2006 Aug 09
3
[Markaby] yield instead of @content_for_layout?
We''re supposed to use yield instead of @content_for_layout, but I can''t 
get yield to work in a Markaby template:
yield
text yield
Either one of these lines results in a ''no block given'' error (but ''text 
@content_for_layout'' works). Anybody know how to use yield instead?
Thanks,
Joe
-- 
Posted via http://www.ruby-forum.com/.
2006 Feb 27
1
@content_for_sidebar?
Okay, I see this instance variable places, but I can not determine if it is real 
or where the content comes from.  I''ve tried views/<controller>/sidebar.rhtml, 
_sidebar.rhtml, views/layouts/sidebar.rhtml and views/layouts/_sidebar.rhtml.
Does this actually exist?  What''s the Rails Way to make a good sidebar?
http://www.google.com/search?q=content_for_sidebar
Thanks,
2006 Jul 19
4
Using Application.rhtml as layout for all controllers
I put my nav system in application layout.  that way any controller 
loading will have the nav system.  I have one problem though - the <%= 
yield %> is in the body,  so how would my controllers specify other css 
files?
my application layout would look like this:
<html>
<head>
title
css include
javascript include
</head>
<body>
nav system
<%=yield%>
2006 May 23
11
adding layouts within layouts
Hi,
I want to be able to have several layouts within each other so that I don''t
have to keep repeating the layout code for one, in another.  An example
would be having a layout for the title of your web page and then having an
embedded layout for the body portion in which the HTML for whatever view
gets displayed.  Is this possible?
Thanks.
-------------- next part --------------
An
2006 Jul 13
6
Content_for_layout
Question- if I have more then one view I wish to display in a layout , how
do I tell content_for_layout what to display and where ?
TIA
Stuart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060713/a2d0a8c8/attachment.html
2009 Oct 28
2
render :file cached?
In my application I have a controller/view that displays the contents
of an audit log file
  def audit_log
    render :layout => ''table'',  :file => AUDIT_LOG
  end
The audit log is updated frequently but the render call does not re-
read the file so it gets stale.  Is there a way to tell render to
check the file timestamp and reload as needed?
2006 Feb 15
5
Formating @content_for_layout
Hi all, I sent a message earlier, so forgive me if you have already
read this (I got some cryptic message in German about how my
e-mail was not read?). Anyway, I was just wondering if there was
any way to format the html that is output using
<%= @content_for_layout %>
I want to use something like the PHP Beautify. I guess I could
write my own, but I was hoping that Rails already had
2005 Dec 31
7
Application Errors w/ layout & custom view pages
1) I get Rails Application Error when trying to use layout
test_controller
def list
   layout "stdlayout"
end
in the views/test/layouts stdlayout.rhtml
<html>
<head><title>test</title></head>
</body>
<h1>Test</h1>
<%= content_for_layout %>
</body>
</html>
2) I get Rails Application Error when trying to use a separate
2006 Mar 13
5
What is the matter with content_for_layout?
Here is my layout file:
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
  <title>My Demands</title>
  <%= stylesheet_link_tag ''ajax_scaffold'', :media => ''all'' %>
  <%=
2006 Dec 17
1
Markaby template & layout (can't get them to work together)
Hi all,
I am starting a new rails app with the Markaby plugin (had some issues
installing, but think its working).
First, i created an index.mab file for a controller containing:
  h1 "First template"
That rendered fine. Also, I do not have a "def index ..." in the
controller.
Then I created an app/layouts/application.mab file. It didn''t get picked
up until after
2005 May 01
5
Example using Builder::XmlMarkup and .rxml files?
Greetings,
I''m a newby to both "R"s in RoR.  I would like to use Builder::XmlMarkup
to generate my pages.  If there is a working downloadable example
somewhere, that would probably be enough.  Otherwise, here''s what
I want to do:
With the following controller:
class AccountsController < ApplicationController
  layout  ''accounts''
  model :account
 
2006 Jul 27
3
Multiple @content_for_layout in template?
Hi guys,
I''m having a few experiments making sites with Rails and I''ve come 
across a problem. I''ve made a template for the parts of the site that 
the public will see and it has two main columns in it, a main content 
column and a thin side column. The content in each of these will change 
on each page of the site but I''m not exactly sure about how to send 
2006 Jan 15
7
Include extra partial in layouts
Hi all,
Does anybody know how to include a partial (next to @content_for_layout) in a 
layout file?
I''m looking for a something like @partial_for_include => ''filename'' in my 
layout files. So a linked .rhtml file gets picked up from within a layout 
file. All my layout files (4 at the moment) have a <div class="navright"> 
tag, so one change in the
2006 Jul 13
3
Validation question
If I am validating an object before it is saved and do a find(:all) of
that object class, will the object which is being validated be returned 
by
the find method?
something like:
class Resource < ActiveRecord::Base
def validate
  resources = Resource.find(:all)
  ..do stuff
end
Will the object I am validating be in the ''resources'' array?
Thanks in advance,
Don Mc
-- 
2006 Mar 31
3
Layout Question .. (Sitemesh related)
Hi,
I understand that the layout concept is very similar to OpenSymphony''s
Sitemesh project. I have done a lot of development with Sitemesh, but am
fairly new to Rails. I am wondering if there is a way for a layout in
rails to find out value of a variable from a page it is decorating?
In sitemesh you would be able to do <meta name="show_menu"
content="true"> on
2006 Jun 22
4
stylesheet linking and layouts
In my layout, I have something like (shortened for clarity):
<html>
<head>
<%= stylesheet_link_tag "index", :media => "all" %>
</head>
<body>
<div id="site-container">
 ... <cut for space>
 <%= @content_for_layout %>
 ... <cut for space>
</div>
</body>
A view action has another stylesheet defined
2007 Dec 08
6
Rails 2.0 ActionMailer breaks my redmine render_message
I am using ''redmine'' (v 0.6)  as my major project manager, seems running
fine w Rails 2.0 (slight modifs for paginations..) but I am stuck with a
major error when sending a confirmation email :
mailer.rb
class Mailer < ActionMailer::Base
....
  # Renders a message with the corresponding layout
  def render_message(method_name, body)
    layout =
2006 Mar 07
3
Can variables in the template be used in the layout?
This may be a silly question, but I''m wanting to develop a query to pull 
''related articles'' based on tags.
When a user clicks on an article to read, on that layout, I want a side 
menu to have the related entries.  If I develop the query to do this, 
can I access the current tags for the entry in the layout?
I guess I''m asking, does <% content_for_layout
2007 Sep 01
2
@content_for_layout or changing default fields on "new" page
Hi all,
I test my small Rails apps using SQLite3, but I think the problem
appeares in every type of database.
.
When I create table and scaffolding apps, a HTML view is based on
columns types. Everything is OK until I want to change preconfigured
behaviour.
.
I created table with a column of type INTEGER, but I wanted to display
check box instead of text field and then save 0 or 1 in database.