similar to: instance vars in layouts

Displaying 20 results from an estimated 4000 matches similar to: "instance vars in layouts"

2006 Jul 09
8
Can the has_many create() method return an ID?
Hi all, I have a has_many relationship, Cookbook :has_many Recipes If I want to create a new recipe in my cookbook I do: cookbook.recipes.create(data) It would be nice if I could then easily get the id of the new recipe, but the create() method doesn''t seem to return anything. Any ideas how? Thanks in advance! Cameron -- Posted via http://www.ruby-forum.com/.
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 07
2
How does layouts work?
When creating a scaffold you get a layout file. How does it work? I thought I would find the var @content_for_layout in the controller, but I didn''t. Where is layouts defined or controlled? -- Posted via http://www.ruby-forum.com/.
2006 Apr 17
2
nesting layouts?
Hi all, Currently I am working on a site which in principle consists of three div''s, a menu, a left div and a right div. Now the content of the left and right div can vary wildly but the overall ''feeling'' should be the same. Now I have one template, called ''index.rhtml'' which checks in a long list of if-then-else what to render. This is of course
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
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 Dec 16
3
Purpose of ''yield'' in layout file in Flickr video?
During the excellent flickr video, the presenter adds the following to the applications layout file: <body> <%= yield %> </body> What is the purpose of the ''yield'' line? I would think there would be a content_for_layout tag there instead. Thanks, Don -- Posted via http://www.ruby-forum.com/.
2006 Apr 12
4
CSS and Javascript with partials and layouts
Hi, I''m developing an application that uses a layout called main on every page. Most of the individual pages are represented with a single partial template, but there are several pages that are composed of multiple partials. My main layout looks something like this: Code: <html> <head> <title><%= @title %></title> <%= stylesheet_link_tag
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 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 06
0
Layouts, Searching/Sorting
Two questions for you all... 1. I have an admin section to a site I''m building. Here''s the pertinent bit of the layout that all controllers are using: <div id="main-content"> <%= @content_for_layout %> </div> <div id="sidebar"> </div> I''m using @content_for_layout to display various controller actions such as new,
2006 Mar 17
2
How to let the layout be more OO?
I am confused about the @content_for_layout.''cause it will display all the views in the layout.Do I have any methods to let the layout be more OO? I mean that for example,the app currently have more than one views to be displayed,but only some of them to be displayed at the same time at different <div></div> units. I hope there exists a kind of way that: <%= if
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 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 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
2006 Jun 22
5
Problems with layouts
ruby script/generate controller Tools::Search - ok in views/layouts/application.rhtml: <%= render_component :controller => ''tools/search'', :action => ''searchbox'', :params => {:context => ''header-section''} %> in
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
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 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 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