<?xml version="1.0" encoding="UTF-8"?>
<tricks type="array">
  <trick>
    <category-id type="integer">7</category-id>
    <comments type="integer"></comments>
    <content nil="true"></content>
    <content-bbcode nil="true"></content-bbcode>
    <content-format>Textile</content-format>
    <content-html nil="true"></content-html>
    <content-textile nil="true"></content-textile>
    <created-at type="datetime">2009-05-11T10:01:14+02:00</created-at>
    <creator-id type="integer">1</creator-id>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <file nil="true"></file>
    <id type="integer">757</id>
    <lang-id type="integer" nil="true"></lang-id>
    <locale>en</locale>
    <nreports type="integer">0</nreports>
    <nvotes type="integer">5</nvotes>
    <permalink>three_profiling_tools</permalink>
    <published-at type="datetime">2009-05-11T14:29:08+02:00</published-at>
    <state>published</state>
    <summary>Ever want to know what Rails is doing under the hood during a request? In this episode Ryan Bates shows three different profiling tools: New Relic RPM, FiveRuns TuneUp, and Rack::Bug.</summary>
    <title>Three Profiling Tools</title>
    <updated-at type="datetime">2009-05-12T12:31:48+02:00</updated-at>
    <updater-id type="integer">205</updater-id>
    <url>http://railscasts.com/episodes/161-three-profiling-tools</url>
    <url-code nil="true"></url-code>
  </trick>
  <trick>
    <category-id type="integer">7</category-id>
    <comments type="integer"></comments>
    <content nil="true"></content>
    <content-bbcode nil="true"></content-bbcode>
    <content-format>Textile</content-format>
    <content-html nil="true"></content-html>
    <content-textile nil="true"></content-textile>
    <created-at type="datetime">2008-08-12T19:18:03+02:00</created-at>
    <creator-id type="integer">1</creator-id>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <file nil="true"></file>
    <id type="integer">380</id>
    <lang-id type="integer" nil="true"></lang-id>
    <locale>en</locale>
    <nreports type="integer">0</nreports>
    <nvotes type="integer">3</nvotes>
    <permalink>passenger_in_development_railscasts</permalink>
    <published-at type="datetime">2009-02-27T09:04:35+01:00</published-at>
    <state>published</state>
    <summary>Tired of juggling multiple Rails apps around with script/server? See how to set up Passenger in development so each one has its own local domain name.</summary>
    <title>Passenger in Development (Railscasts)</title>
    <updated-at type="datetime">2009-02-27T10:04:36+01:00</updated-at>
    <updater-id type="integer">2</updater-id>
    <url>http://railscasts.com/episodes/122-passenger-in-development</url>
    <url-code nil="true"></url-code>
  </trick>
  <trick>
    <category-id type="integer">7</category-id>
    <comments type="integer"></comments>
    <content nil="true"></content>
    <content-bbcode nil="true"></content-bbcode>
    <content-format>Textile</content-format>
    <content-html nil="true"></content-html>
    <content-textile nil="true"></content-textile>
    <created-at type="datetime">2008-08-04T17:55:29+02:00</created-at>
    <creator-id type="integer">1</creator-id>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <file nil="true"></file>
    <id type="integer">366</id>
    <lang-id type="integer" nil="true"></lang-id>
    <locale>en</locale>
    <nreports type="integer">0</nreports>
    <nvotes type="integer">2</nvotes>
    <permalink>non_active_record_model</permalink>
    <published-at type="datetime" nil="true"></published-at>
    <state>queued</state>
    <summary>This episode of Railscasts will show you how to make a model which isn't based on Active Record. You may want to do this if a resource isn't backed by the database.</summary>
    <title>Non Active Record Model</title>
    <updated-at type="datetime">2008-08-04T19:40:16+02:00</updated-at>
    <updater-id type="integer">2</updater-id>
    <url>http://railscasts.com/episodes/121-non-active-record-model</url>
    <url-code nil="true"></url-code>
  </trick>
  <trick>
    <category-id type="integer">7</category-id>
    <comments type="integer"></comments>
    <content nil="true"></content>
    <content-bbcode nil="true"></content-bbcode>
    <content-format>Textile</content-format>
    <content-html nil="true"></content-html>
    <content-textile nil="true"></content-textile>
    <created-at type="datetime">2008-06-23T16:10:30+02:00</created-at>
    <creator-id type="integer">1</creator-id>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <file nil="true"></file>
    <id type="integer">289</id>
    <lang-id type="integer" nil="true"></lang-id>
    <locale>en</locale>
    <nreports type="integer">0</nreports>
    <nvotes type="integer">4</nvotes>
    <permalink>caching_in_rails_2_1</permalink>
    <published-at type="datetime">2008-06-25T15:43:00+02:00</published-at>
    <state>published</state>
    <summary>Rails 2.1 brings some new caching features which makes it very easy to cache any values including models. See how in this episode of Railscasts.</summary>
    <title>Caching in Rails 2.1</title>
    <updated-at type="datetime">2008-07-01T03:41:06+02:00</updated-at>
    <updater-id type="integer">3</updater-id>
    <url>http://railscasts.com/episodes/115</url>
    <url-code nil="true"></url-code>
  </trick>
  <trick>
    <category-id type="integer">7</category-id>
    <comments type="integer"></comments>
    <content nil="true"></content>
    <content-bbcode nil="true"></content-bbcode>
    <content-format>Textile</content-format>
    <content-html nil="true"></content-html>
    <content-textile nil="true"></content-textile>
    <created-at type="datetime">2008-05-23T09:21:39+02:00</created-at>
    <creator-id type="integer">8</creator-id>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <file nil="true"></file>
    <id type="integer">195</id>
    <lang-id type="integer" nil="true"></lang-id>
    <locale>en</locale>
    <nreports type="integer">0</nreports>
    <nvotes type="integer">3</nvotes>
    <permalink>railscast_gem_dependencies</permalink>
    <published-at type="datetime">2008-05-23T21:20:59+02:00</published-at>
    <state>published</state>
    <summary>In Rails 2.1 we now have the ability to set gem dependencies. Now it's easier than ever to specify which ruby gems our rails app relies on.</summary>
    <title>Railscast: Gem Dependencies</title>
    <updated-at type="datetime">2008-05-23T23:21:01+02:00</updated-at>
    <updater-id type="integer">3</updater-id>
    <url>http://railscasts.com/episodes/110</url>
    <url-code nil="true"></url-code>
  </trick>
  <trick>
    <category-id type="integer">7</category-id>
    <comments type="integer"></comments>
    <content nil="true"></content>
    <content-bbcode nil="true"></content-bbcode>
    <content-format>Textile</content-format>
    <content-html nil="true"></content-html>
    <content-textile nil="true"></content-textile>
    <created-at type="datetime">2008-05-12T13:09:08+02:00</created-at>
    <creator-id type="integer">1</creator-id>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <file nil="true"></file>
    <id type="integer">169</id>
    <lang-id type="integer" nil="true"></lang-id>
    <locale>en</locale>
    <nreports type="integer">0</nreports>
    <nvotes type="integer">3</nvotes>
    <permalink>gitting_rails_2_1_rc1</permalink>
    <published-at type="datetime">2008-05-12T16:02:03+02:00</published-at>
    <state>published</state>
    <summary>Rails 2.1 Release Candidate 1 was just released! In this railscasts episode Ryan Bates will show you how to install it into your Rails project.</summary>
    <title>Gitting Rails 2.1 RC1</title>
    <updated-at type="datetime">2008-05-14T00:28:44+02:00</updated-at>
    <updater-id type="integer">8</updater-id>
    <url>http://railscasts.com/episodes/105</url>
    <url-code nil="true"></url-code>
  </trick>
  <trick>
    <category-id type="integer">7</category-id>
    <comments type="integer"></comments>
    <content nil="true"></content>
    <content-bbcode nil="true"></content-bbcode>
    <content-format>Textile</content-format>
    <content-html nil="true"></content-html>
    <content-textile nil="true"></content-textile>
    <created-at type="datetime">2008-05-05T17:06:37+02:00</created-at>
    <creator-id type="integer">1</creator-id>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <file nil="true"></file>
    <id type="integer">149</id>
    <lang-id type="integer" nil="true"></lang-id>
    <locale>en</locale>
    <nreports type="integer">0</nreports>
    <nvotes type="integer">3</nvotes>
    <permalink>exception_notifications</permalink>
    <published-at type="datetime">2008-05-05T21:30:01+02:00</published-at>
    <state>published</state>
    <summary>If you're running a production site, it's a good idea to record all exceptions which occur. See how to set up a notification system which does that in this episode. Yet another great railscast.</summary>
    <title>Exception Notifications</title>
    <updated-at type="datetime">2008-05-06T01:12:23+02:00</updated-at>
    <updater-id type="integer">8</updater-id>
    <url>http://railscasts.com/episodes/104</url>
    <url-code nil="true"></url-code>
  </trick>
  <trick>
    <category-id type="integer">7</category-id>
    <comments type="integer"></comments>
    <content>&lt;h2&gt;This is how he did it:&lt;/h2&gt;


	&lt;h3&gt;Generators&lt;/h3&gt;


&lt;pre&gt;
&lt;code&gt;

  script/generate scaffold announcement message:text starts_at:datetime ends_at:datetime
  script/generate controller javascripts

&lt;/pre&gt;
&lt;/code&gt;

	&lt;h3&gt;View&lt;/h3&gt;


&lt;pre&gt;
&lt;code&gt;

  &amp;lt;!-- layouts/application.html.erb --&amp;gt;
  &amp;lt;% unless current_announcements.empty? %&amp;gt;
  &amp;lt;div id=&quot;announcement&quot;&amp;gt;
    &amp;lt;% for announcement in current_announcements %&amp;gt;
      &amp;lt;p&amp;gt;&amp;lt;%=h announcement.message %&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;% end %&amp;gt;
    &amp;lt;p&amp;gt;&amp;lt;%= link_to_remote &quot;Hide this message&quot;, :url =&amp;gt; &quot;/javascripts/hide_announcement.js&quot; %&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;% end %&amp;gt;

&lt;/pre&gt;
&lt;/code&gt;

	&lt;h3&gt;Model/Helper/Controller/RJS/Route&lt;/h3&gt;


&lt;pre&gt;
&lt;code&gt;

  # models/announcement.rb
  def self.current_announcements(hide_time)
    with_scope :find =&amp;gt; { :conditions =&amp;gt; &quot;starts_at &amp;lt;= now() AND ends_at &amp;gt;= now()&quot; } do
      if hide_time.nil?
        find(:all)
      else
        find(:all, :conditions =&amp;gt; [&quot;updated_at &amp;gt; ?&quot;, hide_time])
      end
    end
  end

  # application_helper.rb
  def current_announcements
    @current_announcements ||= Announcement.current_announcements(session[:announcement_hide_time])
  end

  # javascripts_controller.rb
  def hide_announcement
    session[:announcement_hide_time] = Time.now
  end

  # hide_announcement.js.rjs
  page[:announcement].hide

  # routes.rb
  map.connect &quot;:controller/:action.:format&quot; 

&lt;/pre&gt;
&lt;/code&gt;

	&lt;h2&gt;This is how you could do it&lt;/h2&gt;


	&lt;h3&gt;Plugin installation&lt;/h3&gt;


&lt;pre&gt;
&lt;code&gt;

  script/plugin install http://pmade.com/svn/oss/stickies/trunk

&lt;/pre&gt;
&lt;/code&gt;

	&lt;h3&gt;Somewhere in your application layout:&lt;/h3&gt;


&lt;pre&gt;
&lt;code&gt;

  &amp;lt;%= render_stickies %&amp;gt;

&lt;/pre&gt;
&lt;/code&gt;

	&lt;h3&gt;Application controller&lt;/h3&gt;


&lt;pre&gt;
&lt;code&gt;

  notice_stickie(&quot;This is an announcement!&quot;)

&lt;/pre&gt;
&lt;/code&gt;</content>
    <content-bbcode nil="true"></content-bbcode>
    <content-format>Textile</content-format>
    <content-html nil="true"></content-html>
    <content-textile>h2. This is how he did it:

h3. Generators

&lt;pre&gt;
&lt;code&gt;

  script/generate scaffold announcement message:text starts_at:datetime ends_at:datetime
  script/generate controller javascripts

&lt;/pre&gt;
&lt;/code&gt;

h3. View

&lt;pre&gt;
&lt;code&gt;

  &lt;!-- layouts/application.html.erb --&gt;
  &lt;% unless current_announcements.empty? %&gt;
  &lt;div id=&quot;announcement&quot;&gt;
    &lt;% for announcement in current_announcements %&gt;
      &lt;p&gt;&lt;%=h announcement.message %&gt;&lt;/p&gt;
    &lt;% end %&gt;
    &lt;p&gt;&lt;%= link_to_remote &quot;Hide this message&quot;, :url =&gt; &quot;/javascripts/hide_announcement.js&quot; %&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;% end %&gt;

&lt;/pre&gt;
&lt;/code&gt;

h3. Model/Helper/Controller/RJS/Route

&lt;pre&gt;
&lt;code&gt;

  # models/announcement.rb
  def self.current_announcements(hide_time)
    with_scope :find =&gt; { :conditions =&gt; &quot;starts_at &lt;= now() AND ends_at &gt;= now()&quot; } do
      if hide_time.nil?
        find(:all)
      else
        find(:all, :conditions =&gt; [&quot;updated_at &gt; ?&quot;, hide_time])
      end
    end
  end

  # application_helper.rb
  def current_announcements
    @current_announcements ||= Announcement.current_announcements(session[:announcement_hide_time])
  end

  # javascripts_controller.rb
  def hide_announcement
    session[:announcement_hide_time] = Time.now
  end

  # hide_announcement.js.rjs
  page[:announcement].hide

  # routes.rb
  map.connect &quot;:controller/:action.:format&quot;

&lt;/pre&gt;
&lt;/code&gt;

h2. This is how you could do it

h3. Plugin installation

&lt;pre&gt;
&lt;code&gt;

  script/plugin install http://pmade.com/svn/oss/stickies/trunk

&lt;/pre&gt;
&lt;/code&gt;

h3. Somewhere in your application layout:

&lt;pre&gt;
&lt;code&gt;

  &lt;%= render_stickies %&gt;

&lt;/pre&gt;
&lt;/code&gt;

h3. Application controller

&lt;pre&gt;
&lt;code&gt;

  notice_stickie(&quot;This is an announcement!&quot;)

&lt;/pre&gt;
&lt;/code&gt;</content-textile>
    <created-at type="datetime">2008-04-28T11:13:43+02:00</created-at>
    <creator-id type="integer">1</creator-id>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <file nil="true"></file>
    <id type="integer">102</id>
    <lang-id type="integer" nil="true"></lang-id>
    <locale>en</locale>
    <nreports type="integer">0</nreports>
    <nvotes type="integer">4</nvotes>
    <permalink>site_wide_announcements</permalink>
    <published-at type="datetime">2008-04-28T09:15:59+02:00</published-at>
    <state>published</state>
    <summary>Sometimes you need to display an administrative announcement to every page on the site and give the users the ability to hide the announcement. See how in this episode. Yet another great railscast. Follow the link and make sure to have a look at our content page for an alternative way to do it.</summary>
    <title>Site Wide Announcements</title>
    <updated-at type="datetime">2008-05-01T19:04:03+02:00</updated-at>
    <updater-id type="integer">1</updater-id>
    <url>http://railscasts.com/episodes/103</url>
    <url-code nil="true"></url-code>
  </trick>
</tricks>
