--- !ruby/object:RI::ClassDescription 
attributes: 
- !ruby/object:RI::Attribute 
  comment: 
  name: assigns
  rw: RW
- !ruby/object:RI::Attribute 
  comment: 
  name: base_path
  rw: RW
- !ruby/object:RI::Attribute 
  comment: 
  name: controller
  rw: RW
- !ruby/object:RI::Attribute 
  comment: 
  name: current_render_extension
  rw: RW
- !ruby/object:RI::Attribute 
  comment: 
  name: finder
  rw: R
- !ruby/object:RI::Attribute 
  comment: 
  name: first_render
  rw: RW
- !ruby/object:RI::Attribute 
  comment: 
  name: template_extension
  rw: RW
- !ruby/object:RI::Attribute 
  comment: 
  name: template_format
  rw: W
class_methods: 
- !ruby/object:RI::MethodSummary 
  name: cache_template_extensions=
comment: 
- !ruby/struct:SM::Flow::P 
  body: Action View templates can be written in three ways. If the template file has a <tt>.erb</tt> (or <tt>.rhtml</tt>) extension then it uses a mixture of ERb (included in Ruby) and HTML. If the template file has a <tt>.builder</tt> (or <tt>.rxml</tt>) extension then Jim Weirich's Builder::XmlMarkup library is used. If the template file has a <tt>.rjs</tt> extension then it will use ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.
- !ruby/struct:SM::Flow::H 
  level: 1
  text: ERb
- !ruby/struct:SM::Flow::P 
  body: "You trigger ERb by using embeddings such as &lt;% %&gt;, &lt;% -%&gt;, and &lt;%= %&gt;. The &lt;%= %&gt; tag set is used when you want output. Consider the following loop for names:"
- !ruby/struct:SM::Flow::VERB 
  body: "  <b>Names of all the people</b>\n  &lt;% for person in @people %&gt;\n    Name: &lt;%= person.name %&gt;&lt;br/&gt;\n  &lt;% end %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: "The loop is setup in regular embedding tags &lt;% %&gt; and the name is written using the output embedding tag &lt;%= %&gt;. Note that this is not just a usage suggestion. Regular output functions like print or puts won't work with ERb templates. So this would be wrong:"
- !ruby/struct:SM::Flow::VERB 
  body: "  Hi, Mr. &lt;% puts &quot;Frodo&quot; %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: If you absolutely must write from within a function, you can use the TextHelper#concat.
- !ruby/struct:SM::Flow::P 
  body: "&lt;%- and -%&gt; suppress leading and trailing whitespace, including the trailing newline, and can be used interchangeably with &lt;% and %&gt;."
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Using sub templates
- !ruby/struct:SM::Flow::P 
  body: "Using sub templates allows you to sidestep tedious replication and extract common display structures in shared templates. The classic example is the use of a header and footer (even though the Action Pack-way would be to use Layouts):"
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;%= render &quot;shared/header&quot; %&gt;\n  Something really specific and terrific\n  &lt;%= render &quot;shared/footer&quot; %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: As you see, we use the output embeddings for the render methods. The render call itself will just return a string holding the result of the rendering. The output embedding writes it to the current template.
- !ruby/struct:SM::Flow::P 
  body: "But you don't have to restrict yourself to static includes. Templates can share variables amongst themselves by using instance variables defined using the regular embedding tags. Like this:"
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;% @page_title = &quot;A Wonderful Hello&quot; %&gt;\n  &lt;%= render &quot;shared/header&quot; %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: "Now the header can pick up on the <tt>@page_title</tt> variable and use it for outputting a title tag:"
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;title&gt;&lt;%= @page_title %&gt;&lt;/title&gt;\n"
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Passing local variables to sub templates
- !ruby/struct:SM::Flow::P 
  body: "You can pass local variables to sub templates by using a hash with the variable names as keys and the objects as values:"
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;%= render &quot;shared/header&quot;, { :headline =&gt; &quot;Welcome&quot;, :person =&gt; person } %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: "These can now be accessed in <tt>shared/header</tt> with:"
- !ruby/struct:SM::Flow::VERB 
  body: "  Headline: &lt;%= headline %&gt;\n  First name: &lt;%= person.first_name %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: "If you need to find out whether a certain local variable has been assigned a value in a particular render call, you need to use the following pattern:"
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;% if local_assigns.has_key? :headline %&gt;\n    Headline: &lt;%= headline %&gt;\n  &lt;% end %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: Testing using <tt>defined? headline</tt> will not work. This is an implementation restriction.
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Template caching
- !ruby/struct:SM::Flow::P 
  body: By default, Rails will compile each template to a method in order to render it. When you alter a template, Rails will check the file's modification time and recompile it.
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Builder
- !ruby/struct:SM::Flow::P 
  body: Builder templates are a more programmatic alternative to ERb. They are especially useful for generating XML content. An XmlMarkup object named <tt>xml</tt> is automatically made available to templates with a <tt>.builder</tt> extension.
- !ruby/struct:SM::Flow::P 
  body: "Here are some basic examples:"
- !ruby/struct:SM::Flow::VERB 
  body: "  xml.em(&quot;emphasized&quot;)                              # =&gt; <em>emphasized</em>\n  xml.em { xml.b(&quot;emph &amp; bold&quot;) }                   # =&gt; <b><em>emph &amp;amp; bold</em></b>\n  xml.a(&quot;A Link&quot;, &quot;href&quot;=&gt;&quot;http://onestepback.org&quot;) # =&gt; &lt;a href=&quot;http://onestepback.org&quot;&gt;A Link&lt;/a&gt;\n  xml.target(&quot;name&quot;=&gt;&quot;compile&quot;, &quot;option&quot;=&gt;&quot;fast&quot;)   # =&gt; &lt;target option=&quot;fast&quot; name=&quot;compile&quot;\\&gt;\n                                                    # NOTE: order of attributes is not specified.\n"
- !ruby/struct:SM::Flow::P 
  body: "Any method with a block will be treated as an XML markup tag with nested markup in the block. For example, the following:"
- !ruby/struct:SM::Flow::VERB 
  body: "  xml.div {\n    xml.h1(@person.name)\n    xml.p(@person.bio)\n  }\n"
- !ruby/struct:SM::Flow::P 
  body: "would produce something like:"
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;div&gt;\n    &lt;h1&gt;David Heinemeier Hansson&lt;/h1&gt;\n    &lt;p&gt;A product of Danish Design during the Winter of '79...&lt;/p&gt;\n  &lt;/div&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: "A full-length RSS example actually used on Basecamp:"
- !ruby/struct:SM::Flow::VERB 
  body: "  xml.rss(&quot;version&quot; =&gt; &quot;2.0&quot;, &quot;xmlns:dc&quot; =&gt; &quot;http://purl.org/dc/elements/1.1/&quot;) do\n    xml.channel do\n      xml.title(@feed_title)\n      xml.link(@url)\n      xml.description &quot;Basecamp: Recent items&quot;\n      xml.language &quot;en-us&quot;\n      xml.ttl &quot;40&quot;\n\n      for item in @recent_items\n        xml.item do\n          xml.title(item_title(item))\n          xml.description(item_description(item)) if item_description(item)\n          xml.pubDate(item_pubDate(item))\n          xml.guid(@person.firm.account.url + @recent_items.url(item))\n          xml.link(@person.firm.account.url + @recent_items.url(item))\n\n          xml.tag!(&quot;dc:creator&quot;, item.author_name) if item_has_creator?(item)\n        end\n      end\n    end\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: More builder documentation can be found at http://builder.rubyforge.org.
- !ruby/struct:SM::Flow::H 
  level: 2
  text: JavaScriptGenerator
- !ruby/struct:SM::Flow::P 
  body: JavaScriptGenerator templates end in <tt>.rjs</tt>. Unlike conventional templates which are used to render the results of an action, these templates generate instructions on how to modify an already rendered page. This makes it easy to modify multiple elements on your page in one declarative Ajax response. Actions with these templates are called in the background with Ajax and make updates to the page where the request originated from.
- !ruby/struct:SM::Flow::P 
  body: An instance of the JavaScriptGenerator object named <tt>page</tt> is automatically made available to your template, which is implicitly wrapped in an ActionView::Helpers::PrototypeHelper#update_page block.
- !ruby/struct:SM::Flow::P 
  body: "When an <tt>.rjs</tt> action is called with <tt>link_to_remote</tt>, the generated JavaScript is automatically evaluated. Example:"
- !ruby/struct:SM::Flow::VERB 
  body: "  link_to_remote :url =&gt; {:action =&gt; 'delete'}\n"
- !ruby/struct:SM::Flow::P 
  body: "The subsequently rendered <tt>delete.rjs</tt> might look like:"
- !ruby/struct:SM::Flow::VERB 
  body: "  page.replace_html  'sidebar', :partial =&gt; 'sidebar'\n  page.remove        &quot;person-#{@person.id}&quot;\n  page.visual_effect :highlight, 'user-list'\n"
- !ruby/struct:SM::Flow::P 
  body: This refreshes the sidebar, removes a person element and highlights the user list.
- !ruby/struct:SM::Flow::P 
  body: See the ActionView::Helpers::PrototypeHelper::GeneratorMethods documentation for more details.
constants: []

full_name: ActionView::Base
includes: 
- !ruby/object:RI::IncludedModule 
  name: ERB::Util
- !ruby/object:RI::IncludedModule 
  name: CompiledTemplates
instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: template_format
name: Base
superclass: Object
