<?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>SmartLogic Solutions Blog &#187; Ruby on Rails</title>
	<atom:link href="http://blog.smartlogicsolutions.com/tag/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.smartlogicsolutions.com</link>
	<description>News and updates from the people at SmartLogic Solutions</description>
	<lastBuildDate>Tue, 30 Nov 2010 21:39:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Setting Up Ubuntu 9.10 for Ruby On Rails Development</title>
		<link>http://blog.smartlogicsolutions.com/2010/02/01/setting-up-ubuntu-9-10-for-ruby-on-rails-development/</link>
		<comments>http://blog.smartlogicsolutions.com/2010/02/01/setting-up-ubuntu-9-10-for-ruby-on-rails-development/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 21:09:31 +0000</pubDate>
		<dc:creator>Adam Bachman</dc:creator>
				<category><![CDATA[Adam Bachman]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Passenger]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby Enterprise Edition]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=860</guid>
		<description><![CDATA[This is a document I put together at the beginning of 2010 while building yet another Ubuntu VM, digging through our internal documentation to try and find out what I needed. We've got the answers, and generally Ruby, Rails, and Ubuntu are pretty good about telling you how to install tools if you don't have them yet.

But the answers are spread out and distributed randomly. Plus, I can only see "The program '______' is currently not installed. You can install it by typing: sudo apt-get install ______" so many times before I lose interest and put off the task.

So, to prevent future headaches and help all of us out, I put together a how-to that can take a new Rails system from zero to code in a few minutes (depending on network speed) instead of half a day.]]></description>
			<content:encoded><![CDATA[<p>This is a document I put together at the beginning of 2010 while building yet another Ubuntu VM, digging through our internal documentation to try and find out what I needed. We&#8217;ve got the answers, and generally Ruby, Rails, and Ubuntu are pretty good about telling you how to install tools if you don&#8217;t have them yet.</p>
<p>But the answers are spread out and distributed randomly. Plus, I can only see &#8220;The program &#8216;______&#8217; is currently not installed. You can install it by typing: sudo apt-get install ______&#8221; so many times before I lose interest and put off the task.</p>
<p><span id="more-860"></span></p>
<p>So, to prevent future headaches and help all of us out, I put together a how-to that can take a new Rails system from zero to code in a few minutes (depending on network speed) instead of half a day. With no further ado,</p>
<h2>Setting up an Ubuntu box for Rails Development (including virtual machines)</h2>
<h4>Update everything</h4>
<pre>$ sudo aptitude update &amp;&amp; sudo aptitude dist-upgrade</pre>
<h4>Install necessary packages</h4>
<pre>$ sudo aptitude install build-essential vim \
  vim-runtime git-core subversion libsqlite3-dev</pre>
<p>We have projects in git (the newer ones) and svn, so we have to be able to switch fluidly between the two.</p>
<p>And I&#8217;m not trying to start a flame war, but Vim is the first choice for Rails development. You don&#8217;t have to take my word for it; <a href="http://weblog.jamisbuck.org/2008/10/10/coming-home-to-vim">Jamis Buck</a>, <a href="http://github.com/tpope">Tim Pope</a>, and <a href="http://www.adamlowe.me/2009/12/vim-destroys-all-other-rails-editors.html">Adam Lowe</a> all say the same. I recommend the NERDTree, FuzzyFinderTextMate, BufExplorer, and rails.vim plugins if nothing else.</p>
<h4>Install ruby</h4>
<pre>$ sudo aptitude install ruby1.8 ruby rdoc ruby1.8-dev \
  libpgsql-ruby1.8 libmysql-ruby1.8 irb libopenssl-ruby</pre>
<h4>Get rubygems from source. <a href="http://docs.rubygems.org/">http://docs.rubygems.org/</a></h4>
<pre>$ wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz</pre>
<pre>$ tar xzvf rubygems-1.3.5.tgz</pre>
<pre>$ cd rubygems-1.3.5</pre>
<pre>$ sudo ruby setup.rb</pre>
<pre>$ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem</pre>
<pre>$ sudo gem update --system</pre>
<h4>Update ~/.gemrc (at least the :sources: chunk)</h4>
<pre>---
gem: --no-ri --no-rdoc
:benchmark: false
:verbose: true
:backtrace: false
:update_sources: true
:sources:
- http://gemcutter.org
- http://gems.rubyforge.org/
- http://gems.github.com</pre>
<h4>Install and setup Passenger (optional)</h4>
<pre>$ sudo apt-get install apache2-prefork-dev</pre>
<pre>$ sudo gem install passenger</pre>
<pre>$ sudo passenger-install-apache2-module</pre>
<p>and follow the instructions passenger gives you. Most folks in the office run some form of an Apache-Passenger stack for development purposes. I can explain how that setup works in a future post.</p>
<h4>Install geminstaller</h4>
<pre>$ sudo gem install geminstaller</pre>
<p>Almost all of our legacy projects use <a href="http://geminstaller.rubyforge.org/">geminstaller</a> to manage gem dependencies. In the future, new projects will be moving to <a href="http://github.com/wycats/bundler">Bundler</a>, but legacy projects matter and upgrading subsystems is not always justified.</p>
<p>&#8220;If it ain&#8217;t broke, don&#8217;t fix it&#8221; and the corollary: &#8220;because you probably won&#8217;t be able to bill it to the client&#8221; both apply.</p>
<h4>Install common packages (optional, may be required by projects)</h4>
<pre>$ sudo aptitude install imagemagick</pre>
<pre>$ sudo gem install utility_belt open_gem redgreen</pre>
<p>The first (imagemagick) is used by the Paperclip gem to manage files attached to Rails models. The second are tools that make Rails development more manageable on the command line. I highly recommend them. Besides, I&#8217;ve been sneaking redgreen in as a test dependency on our projects, so if you&#8217;re a developer here you&#8217;ll have to install it anyways.</p>
<h4>Create an ssh key (follow instructions)</h4>
<pre>$ ssh-keygen</pre>
<h3>EXAMPLE PROJECT</h3>
<p>All the stuff above won&#8217;t let you test-code-deploy without hassles, so here&#8217;s a sample run through of what the last mile of project-specific setup looks like.</p>
<h4>Get the project. SVN, Git, whatever. Go to it.</h4>
<pre>$ svn co rails-project</pre>
<pre>$ cd rails-project</pre>
<h4>Run geminstaller</h4>
<pre>$ sudo geminstaller                                 # normal</pre>
<pre>$ sudo geminstaller -c config/test/geminstaller.yml # test env</pre>
<h4>Install necessary aptitude packages</h4>
<pre>$ sudo aptitude install texlive-latex-base</pre>
<p>Don&#8217;t ask.</p>
<h4>Create the test database</h4>
<p>Mysql:</p>
<pre>$ rake RAILS_ENV=test db:create</pre>
<p>Postgres (using your username or DB username in place of &#8220;username&#8221;):</p>
<pre>$ sudo -u postgres psql</pre>
<pre>postgres=# CREATE USER username SUPERUSER;</pre>
<pre>postgres=# CREATE DATABASE username OWNER username;</pre>
<p>If you get an error regarding PGconn.quote_ident (Rails 2.3.x on Ubuntu 8.04) patch <code>activerecord-2.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb</code> and add the following:</p>
<pre>def PGconn.quote_ident(name)
  %("#{name}")
end</pre>
<p>immediately after the &#8220;class PGresult&#8221; definition at the top of the file. Once that&#8217;s all done, the following:</p>
<pre>$ rake RAILS_ENV=test db:create</pre>
<pre>$ rake RAILS_ENV=test db:schema:load</pre>
<pre>$ rake RAILS_ENV=test test</pre>
<p>should work.</p>
<h3>go have fun, write code, blow our minds</h3>
<p>So that&#8217;s how we roll. Awkward requirements will still crop up as we pick up new projects (or very old projects) so you&#8217;ll always need a bit of apt/gem fu to get you through the day. Leave questions here or drop me a line at <a href="mailto:adam@smartlogicsolutions.com">adam@smartlogicsolutions.com</a> or <a href="http://twitter.com/abachman">http://twitter.com/abachman</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2008/07/07/i-cant-upgrade-rubygems-from-111-to-120-on-ubuntu/" rel="bookmark" class="crp_title">I can&#8217;t upgrade RubyGems from 1.1.1 to 1.2.0 on Ubuntu</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/04/26/integrity-ci-on-passenger-222-with-ruby-enterprise-edition-on-ubuntu-804/" rel="bookmark" class="crp_title">Integrity CI on Passenger 2.2.2 with Ruby Enterprise Edition on Ubuntu 8.04</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/01/14/aptinstaller-032-released/" rel="bookmark" class="crp_title">Aptinstaller 0.3.2 Released</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/08/04/introducing-environmentalize-an-intuitive-environment-focused-config-structure-for-your-rails-applications/" rel="bookmark" class="crp_title">Introducing environmentalist: an intuitive, environment-focused config structure for your rails applications</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/06/06/deploying-rails-apps-with-capistrano-without-root-or-sudo-privileges/" rel="bookmark" class="crp_title">Deploying Rails Apps with Capistrano without root or sudo Privileges</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2010/02/01/setting-up-ubuntu-9-10-for-ruby-on-rails-development/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Advanced Model Based searches in rails</title>
		<link>http://blog.smartlogicsolutions.com/2008/07/21/advanced-model-based-searches-in-rails/</link>
		<comments>http://blog.smartlogicsolutions.com/2008/07/21/advanced-model-based-searches-in-rails/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 16:24:55 +0000</pubDate>
		<dc:creator>Scott Davis</dc:creator>
				<category><![CDATA[ActiveRecord]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Scott Davis]]></category>
		<category><![CDATA[Advanced Search]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=102</guid>
		<description><![CDATA[After watching a railscast episode on advanced searching I thought I would give it a try. So I came up with a slightly modified version that would handle my search. Model class ExportSearch &#160; def timecards find_cards end &#160; def users&#40;u&#41; @u = u end &#160; def projects&#40;p&#41; @p = p end &#160; def tasks&#40;t&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>After watching a <a href="http://railscasts.com/episodes/111" target="_blank">railscast episode</a> on advanced searching I thought I would give it a try.  So I came up with a slightly modified version that would handle my search.</p>
<h3>Model</h3>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> ExportSearch
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> timecards
    find_cards
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> users<span style="color:#006600; font-weight:bold;">&#40;</span>u<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@u</span> = u
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> projects<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">p</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    @<span style="color:#CC0066; font-weight:bold;">p</span> = <span style="color:#CC0066; font-weight:bold;">p</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> tasks<span style="color:#006600; font-weight:bold;">&#40;</span>t<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@t</span> = t
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> dates<span style="color:#006600; font-weight:bold;">&#40;</span>date1, date2<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@d1</span> = date1
    <span style="color:#0066ff; font-weight:bold;">@d2</span> = date2
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> clients<span style="color:#006600; font-weight:bold;">&#40;</span>c<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@c</span> = c
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
private
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> find_cards
    TimeCard.<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:#ff3333; font-weight:bold;">:conditions</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> conditions, :<span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>:task <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:project</span><span style="color:#006600; font-weight:bold;">&#125;</span>, <span style="color:#ff3333; font-weight:bold;">:order</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:date</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> projects_conditions
    <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;tasks.project_id IN (?)&quot;</span>, @<span style="color:#CC0066; font-weight:bold;">p</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> @<span style="color:#CC0066; font-weight:bold;">p</span>.<span style="color:#9900CC;">blank</span>?
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> client_conditions
    <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;projects.client_id IN (?)&quot;</span>, <span style="color:#0066ff; font-weight:bold;">@c</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#0066ff; font-weight:bold;">@c</span>.<span style="color:#9900CC;">blank</span>?
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> date_conditions
    <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;date BETWEEN ? AND ?&quot;</span>, <span style="color:#0066ff; font-weight:bold;">@d1</span>, <span style="color:#0066ff; font-weight:bold;">@d2</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#006600; font-weight:bold;">&#40;</span>@d1.<span style="color:#9900CC;">blank</span>? <span style="color:#006600; font-weight:bold;">||</span> <span style="color:#0066ff; font-weight:bold;">@d2</span>.<span style="color:#9900CC;">blank</span>?<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> task_conditions
    <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;task_id IN (?)&quot;</span>, <span style="color:#0066ff; font-weight:bold;">@t</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#0066ff; font-weight:bold;">@t</span>.<span style="color:#9900CC;">blank</span>?
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> users_conditions
    <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;user_id IN (?)&quot;</span>, <span style="color:#0066ff; font-weight:bold;">@u</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#0066ff; font-weight:bold;">@u</span>.<span style="color:#9900CC;">blank</span>?
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> conditions
    <span style="color:#006600; font-weight:bold;">&#91;</span>conditions_clauses.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">' AND '</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#006600; font-weight:bold;">*</span>conditions_options<span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> conditions_clauses
    conditions_parts.<span style="color:#9900CC;">map</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>condition<span style="color:#006600; font-weight:bold;">|</span> condition.<span style="color:#9900CC;">first</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> conditions_options
    conditions_parts.<span style="color:#9900CC;">map</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>condition<span style="color:#006600; font-weight:bold;">|</span> condition<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span>..<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">flatten</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> conditions_parts
    private_methods<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">grep</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>_conditions$<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">map</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>m<span style="color:#006600; font-weight:bold;">|</span> send<span style="color:#006600; font-weight:bold;">&#40;</span>m<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">compact</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<h3>Controller</h3>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">    search = ExportSearch.<span style="color:#9900CC;">new</span>
    search.<span style="color:#9900CC;">users</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;">:export</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:users</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">','</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:export</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:users</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">blank</span>?
    search.<span style="color:#9900CC;">tasks</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;">:export</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:tasks</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">','</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:export</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:tasks</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">blank</span>?
    search.<span style="color:#9900CC;">projects</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;">:export</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:projects</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">','</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:export</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:projects</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">blank</span>?
    search.<span style="color:#9900CC;">dates</span><span style="color:#006600; font-weight:bold;">&#40;</span>start_date, end_date<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
    <span style="color:#0066ff; font-weight:bold;">@time_cards</span> = search.<span style="color:#9900CC;">timecards</span></pre></div></div>

<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2009/10/23/dry-up-your-controllers-with-find_or_redirect/" rel="bookmark" class="crp_title">DRY up your Controllers with find_or_redirect</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/10/merging-a-has_many-relationship-into-one-instance/" rel="bookmark" class="crp_title">Merging a :has_many relationship into one instance</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/06/11/multithreading-in-ruby-on-rails/" rel="bookmark" class="crp_title">Multithreading in Ruby on Rails</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/10/28/faking-a-will-paginate-collection-on-an-active-resource-model/" rel="bookmark" class="crp_title">Faking a Will Paginate Collection on an Active Resource model</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/06/05/mapresources-and-custom-nested-routes/" rel="bookmark" class="crp_title">map.resources and custom nested routes</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2008/07/21/advanced-model-based-searches-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

