<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Doodads and Whatnot &#187; ruby on rails</title>
	<atom:link href="http://hazy.stupor.org/blog/archives/category/ruby-on-rails/feed" rel="self" type="application/rss+xml" />
	<link>http://hazy.stupor.org/blog</link>
	<description></description>
	<lastBuildDate>Sun, 27 Jun 2010 09:15:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>has_wiki_field: quickly building a wiki in Ruby on Rails</title>
		<link>http://hazy.stupor.org/blog/archives/28</link>
		<comments>http://hazy.stupor.org/blog/archives/28#comments</comments>
		<pubDate>Mon, 17 Dec 2007 02:46:12 +0000</pubDate>
		<dc:creator>toholio</dc:creator>
				<category><![CDATA[Nerdy]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://hazy.stupor.org/blog/archives/28</guid>
		<description><![CDATA[Has the boss just discovered wikis? Does he now want to be able to create links between records in your intranet applications? Need to quickly add wiki functionality to your models and views so you can get back on with your life? That&#8217;s what happened to me recently. Since the wiki code was almost exactly [...]]]></description>
			<content:encoded><![CDATA[<p>Has the boss just discovered wikis? Does he now want to be able to create links between records in your intranet applications? Need to quickly add wiki functionality to your models and views so you can get back on with your life?</p>
<p>That&#8217;s what happened to me recently. Since the wiki code was almost exactly the same for all of the applications that needed changing, I&#8217;ve put the code into a plugin. Hopefully someone else will find it useful.</p>
<h3>Installing the plugin</h3>
<p>The plugin is installed in the same manner as any other. Fire up your favourite terminal and navigate to the root of your rails application. Then run the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">script/plugin install http://hazy.stupor.org/svn/has_wiki_field/trunk/has_wiki_field/</pre></div></div>

<p>That should be all that is required.</p>
<h3>Using the plugin</h3>
<p>The following example should get you up and running quickly but make sure you read the efficiency note below.</p>
<p>Lets say you have a Person model that has name and bio attributes. We would like to be able to link to other people from within a bio. So in Allan&#8217;s record we might want the bio to read &#8220;This man is friends with [[Betty]]&#8221; and have [[Betty]] automatically change into a link to her record when it is displayed.</p>
<p>We, start by adding has_wiki_field to the Person model:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Person <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  has_wiki_field <span style="color:#ff3333; font-weight:bold;">:field</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;name&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:sql_match</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;LIKE&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The :field option specifies what field should be matched by the text in [[links]]. The :sql_match option specifies how the records should be matched. :sql_match defaults to &#8220;=&#8221; but using &#8220;LIKE&#8221; will allow case insensitive links.</p>
<p>Now we need to change show.html.erb for the people controller so that links are generated from the bio.</p>
<p>Where previously we might have displayed a bio using:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= h <span style="color:#0066ff; font-weight:bold;">@person</span>.<span style="color:#9900CC;">bio</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p>We will now use the wikify method, passing it the name of the attribute to wikify and a code block which generates the html for links. A code block is used to allow flexibility in link generation. The following block simply calls link_to but you could, for example, write a block which looks up an image associated with your model and displays that instead.</p>
<p>Anyway, for our Person model we add the following to the view:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#0066ff; font-weight:bold;">@person</span>.<span style="color:#9900CC;">wikify</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:bio</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>name, object<span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#9966CC; font-weight:bold;">if</span> object.<span style="color:#0000FF; font-weight:bold;">nil</span>?
      h name
    <span style="color:#9966CC; font-weight:bold;">else</span>
      link_to name, object
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p>In a real application this should be put into a method in people_helper to help keep things tidy.</p>
<p>That&#8217;s it! Where [[Some Name]] appears in a Person&#8217;s bio it will be turned into a link to the person with the name &#8216;Some Name&#8217;.</p>
<p>Remember to read the important efficiency note section below before using this in a production environment.</p>
<h3>An important note about efficiency</h3>
<p>The default method used for finding which object a [[link]] points to is not efficient. For sites that receive more than a tiny amount of traffic it should be replaced by your own model specific method.</p>
<p>The default method takes the contents of each [[link]] and queries the database for the first record that has &#8216;link&#8217; as the value for the field specified in the model, I.e.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">find<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:first</span>, <span style="color:#ff3333; font-weight:bold;">:conditions</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;somefieldname = ?&quot;</span>, key<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>This will obviously require a database look-up for every link which could slow your site down tremendously for pages containing many links.</p>
<p>To fix this you must provide your own method to match objects with the keys extracted from [[links]]. The class method to override for this is object_for_key(key).</p>
<p>For example, if we have a class called Person we might replace the object_for_key method like so:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Person <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  has_wiki_field
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">object_for_key</span><span style="color:#006600; font-weight:bold;">&#40;</span> key <span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#008000; font-style:italic;"># some super fast method for matching the key</span>
    <span style="color:#008000; font-style:italic;"># from a link to a person object, goes here...</span>
    <span style="color:#008000; font-style:italic;">#</span>
    <span style="color:#008000; font-style:italic;"># return the Person object that matches or nil if there is no match</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Naturally, it&#8217;s up to you to manage the data used by your object_for_key method. wiki_options[:field] and wiki_options[:sql_match] will be available to you in this method if they were set as options to has_wiki_field.</p>
<h3>Future plans</h3>
<p>The plugin doesn&#8217;t do much currently. If I&#8217;d only needed it for a single application there&#8217;s a good chance it wouldn&#8217;t have made it into a plugin at all. It has provided me with a reasonable starting point for my applications and hopefully it&#8217;ll get better as time goes on.</p>
<p>Some ideas for future versions:</p>
<ul>
<li>Add a controller action which takes a key and redirects to the appropriate record or creates a new record with the needed field already filled.</li>
<li>Using the new controller method above, allow links of the form [[Some Key#Model]] where &#8220;Model&#8221; specifies what type of thing links are pointing to. Ta-dah! Now we can link between all the models in an application. </li>
<li>Implement some basic object_for_key methods for common situations. The plugin should attempt to gently direct programers towards these methods.</li>
<li>Implement a basic link caching mechanism. When a has_wiki_field model is saved links should be extracted and stored in a table. Then all current links for a model can be loaded in a single database transaction.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://hazy.stupor.org/blog/archives/28/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generating an iCalendar feed from a controller in Ruby on Rails</title>
		<link>http://hazy.stupor.org/blog/archives/27</link>
		<comments>http://hazy.stupor.org/blog/archives/27#comments</comments>
		<pubDate>Wed, 12 Dec 2007 04:54:17 +0000</pubDate>
		<dc:creator>toholio</dc:creator>
				<category><![CDATA[Nerdy]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://hazy.stupor.org/blog/archives/27</guid>
		<description><![CDATA[Recently I needed to set-up an application to keep track of regular safety inspections for power tools and other equipment. The application is very trivial but my client was quite pleased with one particular feature which wasn&#8217;t actually requested. The &#8220;bonus&#8221; feature was an iCalendar feed which allows the client to have his computers subscribe [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I needed to set-up an application to keep track of regular safety inspections for power tools and other equipment. The application is very trivial but my client was quite pleased with one particular feature which wasn&#8217;t actually requested.</p>
<p>The &#8220;bonus&#8221; feature was an iCalendar feed which allows the client to have his computers subscribe to the feed and keep up to date with what equipment needs inspecting and when. Very swish and, thanks to Rails and a nice gem, very easy.</p>
<p>So how&#8217;s it done? Easy!</p>
<p>Lets start by installing <a href="http://icalendar.rubyforge.org/">the icalendar gem</a>. Open a terminal and install it as normal:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">user@host railsapp$ gem install icalendar</pre></div></div>

<p>Change to the vendor directory of your Rails application and unpack the gem:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">user@host railsapp$ cd vendor/
user@host vendor$ gem unpack icalendar</pre></div></div>

<p>Make sure it will be loaded by adding it to the end of config/environment.rb in your Rails application:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'icalendar-1.0.2/lib/icalendar'</span></pre></div></div>

<p>Now we&#8217;re ready to add a calendar feed to our application. Lets say we have a table that contains the names and scheduled service dates of some tools. The client wants, or is going to get, a feed which marks each tool needing service in their calendar when their servicing is due.</p>
<p>Generating the iCalendar data is simple. The following method from tool_controller creates an event for each tool and inserts it into a calendar. The to_ical call at the end of the method get the calendar as a string which can be served to the user. Note that this method assumes the @tools variable has already been set (you could always add a call to Tool.find(:all) at the start of the method if needed).</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> generate_ical
  cal = <span style="color:#6666ff; font-weight:bold;">Icalendar::Calendar</span>.<span style="color:#9900CC;">new</span>
  <span style="color:#0066ff; font-weight:bold;">@tools</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>tool<span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#008000; font-style:italic;"># create the event for this tool</span>
    event = <span style="color:#6666ff; font-weight:bold;">Icalendar::Event</span>.<span style="color:#9900CC;">new</span>
    event.<span style="color:#9900CC;">start</span> = tool.<span style="color:#9900CC;">inspection_date</span>
    event.<span style="color:#9966CC; font-weight:bold;">end</span> = tool.<span style="color:#9900CC;">inspection_date</span>
    event.<span style="color:#9900CC;">summary</span> = <span style="color:#996600;">&quot;Service of &quot;</span> <span style="color:#006600; font-weight:bold;">+</span> tool.<span style="color:#9900CC;">name</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot; is due.&quot;</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># insert the event into the calendar</span>
    cal.<span style="color:#9900CC;">add</span> event
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># return the calendar as a string</span>
  cal.<span style="color:#9900CC;">to_ical</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Next, we add the icalendar feed to respond_to in the tools_controller&#8217;s index method. We&#8217;ll make this call the generate_ical method to get the calendar data.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> index
  <span style="color:#0066ff; font-weight:bold;">@tools</span> = Tool.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:all</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  respond_to <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>format<span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">html</span> <span style="color:#008000; font-style:italic;"># index.html.erb</span>
    <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">xml</span>  <span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:xml</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@tools</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">ics</span>  <span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:text</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">generate_ical</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>And now you should be able to open your calendar application and subscribe to the feed straight from the tools controller using a URL like http://example.com/tools.ics</p>
]]></content:encoded>
			<wfw:commentRss>http://hazy.stupor.org/blog/archives/27/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Easy filtering by optional criteria in Rails applications</title>
		<link>http://hazy.stupor.org/blog/archives/26</link>
		<comments>http://hazy.stupor.org/blog/archives/26#comments</comments>
		<pubDate>Wed, 12 Dec 2007 02:26:51 +0000</pubDate>
		<dc:creator>toholio</dc:creator>
				<category><![CDATA[Nerdy]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://hazy.stupor.org/blog/archives/26</guid>
		<description><![CDATA[I&#8217;ve frequently needed a very simple search method that allows partial matches for any combination of fields in a table. The following snippet shows how an ActiveRecord derived object might have a filter to allow for selection of records given a set of partial values. class YourClass &#60; ActiveRecord::Base def self.filter&#40; partial_values &#41; # don't [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve frequently needed a very simple search method that allows partial matches for any combination of fields in a table. The following snippet shows how an ActiveRecord derived object might have a filter to allow for selection of records given a set of partial values.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> YourClass <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
   <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">filter</span><span style="color:#006600; font-weight:bold;">&#40;</span> partial_values <span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#008000; font-style:italic;"># don't bother at all if there is no search object</span>
    <span style="color:#0000FF; font-weight:bold;">return</span> find<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:all</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> partial_values
&nbsp;
    con_string = <span style="color:#996600;">&quot;&quot;</span>
    con_array = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># build collection of conditions</span>
    partial_values.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>key,value<span style="color:#006600; font-weight:bold;">|</span>
      <span style="color:#9966CC; font-weight:bold;">if</span> value != <span style="color:#996600;">&quot;&quot;</span> <span style="color:#9966CC; font-weight:bold;">then</span>
        con_string <span style="color:#006600; font-weight:bold;">+</span>= <span style="color:#996600;">&quot; and &quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> con_array.<span style="color:#9900CC;">size</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">0</span>
        con_string <span style="color:#006600; font-weight:bold;">+</span>= <span style="color:#996600;">&quot;#{key} LIKE ?&quot;</span>
        con_array <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;%#{value}%&quot;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># construct the actual conditions array</span>
    conditions = <span style="color:#006600; font-weight:bold;">&#91;</span>con_string<span style="color:#006600; font-weight:bold;">&#93;</span>
    con_array.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>item<span style="color:#006600; font-weight:bold;">|</span> conditions <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> item <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
    find<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:all</span>, <span style="color:#ff3333; font-weight:bold;">:conditions</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> conditions<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>To use this you would obtain a set of search parameters, one for each filterable column, and pass it to YourClass.filter as a hash to get the matching rows.</p>
<p>So if you had a table with title and category columns you might create a page containing a form to collect partial value for filtering. When creating the form, assuming you will use Rails&#8217; form helpers, the fields_for :collection function is nice as it will allow for easy collection of a hash for the field values.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span> form_tag your_object_path, <span style="color:#ff3333; font-weight:bold;">:method</span> <span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;get&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
	<span style="color:#006600; font-weight:bold;">&lt;%</span> fields_for <span style="color:#ff3333; font-weight:bold;">:partial_values</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
		Title contains: <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">text_field</span> <span style="color:#ff3333; font-weight:bold;">:title</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;br /&gt;
		Category contains: <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">text_field</span> <span style="color:#ff3333; font-weight:bold;">:category</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;br /&gt;
	<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
	<span style="color:#006600; font-weight:bold;">&lt;%</span>= submit_tag <span style="color:#996600;">&quot;Filter items&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p>Then once the form is submitted you would get the appropriate results in your controller using:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#0066ff; font-weight:bold;">@your_objects</span> = YourClass.<span style="color:#9900CC;">filter</span><span style="color:#006600; font-weight:bold;">&#40;</span> params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:partial_values</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://hazy.stupor.org/blog/archives/26/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.484 seconds -->
