<?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"
	>

<channel>
	<title>rails:freeze:gems &#124; freezzo.com</title>
	<atom:link href="http://www.freezzo.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.freezzo.com</link>
	<description>A blog about web development, especially ruby on rails.</description>
	<pubDate>Thu, 29 Jul 2010 15:03:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>How to create PDF&#8217;s and Images from your website in Rails</title>
		<link>http://www.freezzo.com/2010/07/29/how-to-create-pdfs-and-images-from-your-website-in-rails/</link>
		<comments>http://www.freezzo.com/2010/07/29/how-to-create-pdfs-and-images-from-your-website-in-rails/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 15:03:07 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[image]]></category>

		<category><![CDATA[pdf]]></category>

		<category><![CDATA[pdfkit]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[websnap]]></category>

		<category><![CDATA[wkhtmltoimage]]></category>

		<category><![CDATA[wkhtmltopdf]]></category>

		<guid isPermaLink="false">http://www.freezzo.com/?p=118</guid>
		<description><![CDATA[I am going to show you how to generate both a pdf and image from a single action in a controller using the awesome, wkhtmltopdf library. This also uses PDFKit and WebSnap gems available on GitHub.
This example assumes the following:

wkhtmltopdf and wkhtmltoimage are already installed and accessible on in the PATH.
You have an html page [...]]]></description>
			<content:encoded><![CDATA[<p>I am going to show you how to generate both a pdf and image from a single action in a controller using the awesome, wkhtmltopdf library. This also uses PDFKit and WebSnap gems available on GitHub.</p>
<p>This example assumes the following:</p>
<ul>
<li>wkhtmltopdf and wkhtmltoimage are already installed and accessible on in the PATH.
<li>You have an html page setup to display the record.
<li>You have created a pdf CSS file to help display the pdf, if you so choose.
</ul>

<div class="wp_syntax"><div class="code"><pre class="ruby">  <span style="color:#008000; font-style:italic;"># config/initializers/mime_types.rb</span>
  <span style="color:#6666ff; font-weight:bold;">Mime::Type</span>.<span style="color:#9900CC;">register</span> <span style="color:#996600;">&quot;application/pdf&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:pdf</span>
  <span style="color:#6666ff; font-weight:bold;">Mime::Type</span>.<span style="color:#9900CC;">register</span> <span style="color:#996600;">&quot;image/png&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:png</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># app/controllers/items_controller.rb</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> show
    <span style="color:#0066ff; font-weight:bold;">@item</span> = Item.<span style="color:#9900CC;">find</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;">:id</span><span style="color:#006600; font-weight:bold;">&#93;</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:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
      <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">pdf</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
        html = render <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;show.html.erb&quot;</span> 
        kit  = PDFKit.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span> html, <span style="color:#ff3333; font-weight:bold;">:zoom</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">0.75</span> <span style="color:#006600; font-weight:bold;">&#41;</span>
        kit.<span style="color:#9900CC;">stylesheets</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span> RAILS_ROOT, <span style="color:#996600;">&quot;public&quot;</span>, <span style="color:#996600;">&quot;stylesheets&quot;</span>, <span style="color:#996600;">&quot;pdf.css&quot;</span> <span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
        send_data kit.<span style="color:#9900CC;">to_pdf</span>, <span style="color:#ff3333; font-weight:bold;">:filename</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;item.pdf&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:type</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'application/pdf'</span>, <span style="color:#ff3333; font-weight:bold;">:disposition</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'inline'</span>
      <span style="color:#006600; font-weight:bold;">&#125;</span>
      <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">png</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
        html = render <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;show.html.erb&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:layout</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;application.html.erb&quot;</span>
&nbsp;
        <span style="color:#008000; font-style:italic;"># I am nil'ing these options out because my version of wkhtmltoimage does</span>
        <span style="color:#008000; font-style:italic;"># not support the scale options and I do not want to crop the image at all.</span>
        snap = WebSnap.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>html, <span style="color:#ff3333; font-weight:bold;">:format</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'png'</span>, :<span style="color:#996600;">'scale-h'</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span>, :<span style="color:#996600;">'scale-w'</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span>,
          :<span style="color:#996600;">'crop-h'</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span>, :<span style="color:#996600;">'crop-w'</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span>, <span style="color:#ff3333; font-weight:bold;">:quality</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">100</span>, :<span style="color:#996600;">'crop-x'</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span>, :<span style="color:#996600;">'crop-y'</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;">&#41;</span>
&nbsp;
        send_data snap.<span style="color:#9900CC;">to_bytes</span>, <span style="color:#ff3333; font-weight:bold;">:filename</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;item.png&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:type</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;image/png&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:disposition</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'inline'</span>
      <span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now you should be able to access three distinct views, each producing a different result</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">  http:<span style="color:#006600; font-weight:bold;">//</span>example.<span style="color:#9900CC;">com</span><span style="color:#006600; font-weight:bold;">/</span>items<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">1</span> <span style="color:#008000; font-style:italic;"># =&gt; Generates an html page.</span>
  http:<span style="color:#006600; font-weight:bold;">//</span>example.<span style="color:#9900CC;">com</span><span style="color:#006600; font-weight:bold;">/</span>items<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">1</span>.<span style="color:#9900CC;">pdf</span> <span style="color:#008000; font-style:italic;"># =&gt; Generates a pdf of the html page.</span>
  http:<span style="color:#006600; font-weight:bold;">//</span>example.<span style="color:#9900CC;">com</span><span style="color:#006600; font-weight:bold;">/</span>items<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">1</span>.<span style="color:#9900CC;">png</span> <span style="color:#008000; font-style:italic;"># =&gt; Generates a png of the html page.</span></pre></div></div>

<p>You could easily also add more image types by just created another block for each format, and<br />
changing the :format to whatever one you would like.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freezzo.com/2010/07/29/how-to-create-pdfs-and-images-from-your-website-in-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Request formats, filters, and functional tests&#8230;</title>
		<link>http://www.freezzo.com/2010/03/04/request-formats-filters-and-functional-tests/</link>
		<comments>http://www.freezzo.com/2010/03/04/request-formats-filters-and-functional-tests/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 19:09:01 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[format]]></category>

		<category><![CDATA[functional]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[request]]></category>

		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://www.freezzo.com/?p=114</guid>
		<description><![CDATA[I recently had to write some tests against a controller that was filtering based on the requesting format. In this case, I wanted to allow xml requests only, and redirect to login on everything else. This was fine when browsing or using curl by doing a simple:

skip_before_filter :login_required, :only =&#62; &#91;:create&#93;, :if =&#62; Proc.new &#123;&#124;c&#124; [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to write some tests against a controller that was filtering based on the requesting format. In this case, I wanted to allow xml requests only, and redirect to login on everything else. This was fine when browsing or using curl by doing a simple:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">skip_before_filter <span style="color:#ff3333; font-weight:bold;">:login_required</span>, <span style="color:#ff3333; font-weight:bold;">:only</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:create</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#ff3333; font-weight:bold;">:if</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>c<span style="color:#006600; font-weight:bold;">|</span> c.<span style="color:#9900CC;">request</span>.<span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">xml</span>?<span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>My problem came when I was trying to create tests to verify that both html and xml requests did in fact produce the correct response. After many hours of messing around, I came up with a simple solution. First I skip the filters for every request, then I have another filter to re-enable them on anything but the xml request:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">skip_before_filter <span style="color:#ff3333; font-weight:bold;">:login_required</span>, <span style="color:#ff3333; font-weight:bold;">:only</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:create</span><span style="color:#006600; font-weight:bold;">&#93;</span>
before_fiilter <span style="color:#ff3333; font-weight:bold;">:only</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:create</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>c<span style="color:#006600; font-weight:bold;">|</span>
  c.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:login_required</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> c.<span style="color:#9900CC;">request</span>.<span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">xml</span>?
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Voila!!! This allowed me to continue with my rails testing and browser and curl work appropriately. (I use curl to test the xml request).</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">def</span> test_not_logged_in_normal_post
  post <span style="color:#ff3333; font-weight:bold;">:create</span>, <span style="color:#ff3333; font-weight:bold;">:login</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;test@test.com&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:password</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;test&quot;</span>
  assert_response <span style="color:#ff3333; font-weight:bold;">:redirect</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> test_not_logged_in_xml_post
  post <span style="color:#ff3333; font-weight:bold;">:create</span>, <span style="color:#ff3333; font-weight:bold;">:format</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'xml'</span>, <span style="color:#ff3333; font-weight:bold;">:login</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;test@test.com&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:password</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;test&quot;</span>
  assert_response <span style="color:#ff3333; font-weight:bold;">:success</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.freezzo.com/2010/03/04/request-formats-filters-and-functional-tests/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Including methods and associations in a JSON Data set with Rails</title>
		<link>http://www.freezzo.com/2009/10/02/including-methods-and-associations-in-a-json-data-set-with-rails/</link>
		<comments>http://www.freezzo.com/2009/10/02/including-methods-and-associations-in-a-json-data-set-with-rails/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 13:58:11 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[association]]></category>

		<category><![CDATA[include]]></category>

		<category><![CDATA[json]]></category>

		<category><![CDATA[methods]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[to_json]]></category>

		<guid isPermaLink="false">http://www.freezzo.com/?p=111</guid>
		<description><![CDATA[I was poking around while working with creating an application specifically for web services. We decided to use JSON as the methods of transportation of data, but the problem came when I wanted to include custom methods, or associations in my data set. The solution was fairly simple, using the to_json method.
Suppose you have the [...]]]></description>
			<content:encoded><![CDATA[<p>I was poking around while working with creating an application specifically for web services. We decided to use JSON as the methods of transportation of data, but the problem came when I wanted to include custom methods, or associations in my data set. The solution was fairly simple, using the to_json method.</p>
<p>Suppose you have the following classes:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">class</span> Client <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  has_many <span style="color:#ff3333; font-weight:bold;">:employees</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> Employee <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  belongs_to <span style="color:#ff3333; font-weight:bold;">:client</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> full_name
    <span style="color:#996600;">&quot;#{first_name} #{last_name}&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>We want the controller to return a client with association employees and the full name in the database. Here is how we would go about doing that:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">def</span> show
  <span style="color:#0066ff; font-weight:bold;">@client</span> = Client.<span style="color:#9900CC;">find</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;">:id</span><span style="color:#006600; font-weight:bold;">&#93;</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;">json</span> <span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:json</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@client</span>.<span style="color:#9900CC;">to_json</span><span style="color:#006600; font-weight:bold;">&#40;</span>
      <span style="color:#ff3333; font-weight:bold;">:include</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
        <span style="color:#ff3333; font-weight:bold;">:employee</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
          <span style="color:#ff3333; font-weight:bold;">:only</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:email</span>,
          <span style="color:#ff3333; font-weight:bold;">:methods</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span> <span style="color:#ff3333; font-weight:bold;">:full_name</span> <span style="color:#006600; font-weight:bold;">&#93;</span>
        <span style="color:#006600; font-weight:bold;">&#125;</span>
      <span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#006600; font-weight:bold;">&#41;</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>You will end up with the following data set:</p>

<div class="wp_syntax"><div class="code"><pre>{ client: { name: &quot;Some client&quot;, employee: { email: &quot;test@test.com&quot;, full_name: &quot;John Doe&quot; } } }</pre></div></div>

<p>Forgive me if I messed up the json output&#8230;doing it from memory <img src='http://www.freezzo.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> There are of course way easier uses for this too, but I just decided to spit out a more complex one.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freezzo.com/2009/10/02/including-methods-and-associations-in-a-json-data-set-with-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Will paginate - how to pass custom parameters</title>
		<link>http://www.freezzo.com/2009/07/31/will-paginate-how-to-pass-custom-parameters/</link>
		<comments>http://www.freezzo.com/2009/07/31/will-paginate-how-to-pass-custom-parameters/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 18:06:42 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[paging]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[search]]></category>

		<category><![CDATA[will paginate]]></category>

		<guid isPermaLink="false">http://www.freezzo.com/?p=107</guid>
		<description><![CDATA[I came across and issue today that involved my pagination not working correctly. What was happening was a user would do a search with various criteria and the result would show with pagination links. Once they clicked on a new page, it would return them to a list of results, but that wasn&#8217;t using any [...]]]></description>
			<content:encoded><![CDATA[<p>I came across and issue today that involved my pagination not working correctly. What was happening was a user would do a search with various criteria and the result would show with pagination links. Once they clicked on a new page, it would return them to a list of results, but that wasn&#8217;t using any criteria. The solution was fairly simple, but not obviously documented. (Unless you look in the source files)</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#006600; font-weight:bold;">&lt;%</span>= will_paginate <span style="color:#0066ff; font-weight:bold;">@object</span>, <span style="color:#ff3333; font-weight:bold;">:params</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:custom_param</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@custom_param_value</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p>Here are some additional custom params you can use:</p>
<h3>Display options</h3>
<ul>
<li>:previous_label &#8212; default: &#8220;<< Previous" (this parameter is called :prev_label in versions 2.3.2 and older!)</li>
<li>:next_label &#8212; default: &#8220;Next >>&#8221;</li>
<li>:page_links &#8212; when false, only previous/next links are rendered (default: true)</li>
<li>:inner_window &#8212; how many links are shown around the current page (default: 4)</li>
<li>:outer_window &#8212; how many links are around the first and the last page (default: 1)</li>
<li>:separator &#8212; string separator for page HTML elements (default: single space)</li>
</ul>
<h3>HTML options</h3>
<ul>
<li>:class &#8212; CSS class name for the generated DIV (default: &#8220;pagination&#8221;)</li>
<li>:container &#8212; toggles rendering of the DIV container for pagination links, set to false only when you are rendering your own pagination markup (default: true)</li>
<li>:id &#8212; HTML ID for the container (default: nil). Pass +true+ to have the ID automatically generated from the class name of objects in collection: for example, paginating ArticleComment models would yield an ID of &#8220;article_comments_pagination&#8221;.</li>
</ul>
<h3>Advanced options</h3>
<ul>
<li>:param_name &#8212; parameter name for page number in URLs (default: :page)</li>
<li>:params &#8212; additional parameters when generating pagination links (eg. :controller => &#8220;foo&#8221;, :action => nil)</li>
<li>:renderer &#8212; class name, class or instance of a link renderer (default: WillPaginate::LinkRenderer)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.freezzo.com/2009/07/31/will-paginate-how-to-pass-custom-parameters/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to trim a string and fill remaining space in Ruby</title>
		<link>http://www.freezzo.com/2009/06/14/how-to-trim-a-string-and-fill-remaining-space-in-ruby/</link>
		<comments>http://www.freezzo.com/2009/06/14/how-to-trim-a-string-and-fill-remaining-space-in-ruby/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 19:53:36 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[fill]]></category>

		<category><![CDATA[ltrim]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[string]]></category>

		<category><![CDATA[trim]]></category>

		<guid isPermaLink="false">http://www.freezzo.com/?p=105</guid>
		<description><![CDATA[So I needed a way to take a string, and depending on its size, shorten it and fill the remaining space with some arbitrary sequence of characters. Ljust would work, except for the fact that it will fill a string up to a given length, but I only needed to do this when over a [...]]]></description>
			<content:encoded><![CDATA[<p>So I needed a way to take a string, and depending on its size, shorten it and fill the remaining space with some arbitrary sequence of characters. Ljust would work, except for the fact that it will fill a string up to a given length, but I only needed to do this when over a certain size. Here is an example:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">str = <span style="color:#996600;">&quot;Somereallylongstring&quot;</span>
<span style="color:#9966CC; font-weight:bold;">if</span> str.<span style="color:#9900CC;">length</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">10</span>
  <span style="color:#CC0066; font-weight:bold;">puts</span> str<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span>..<span style="color:#006666;">7</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">'...'</span>
<span style="color:#9966CC; font-weight:bold;">else</span>
  <span style="color:#CC0066; font-weight:bold;">puts</span> str
<span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#008000; font-style:italic;"># =&gt; &quot;Somerea...&quot;</span></pre></div></div>

<p>This is the basic idea of what I wanted to do. I decide to make it cleaner and override the String class like so:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC0066; font-weight:bold;">String</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> lfill<span style="color:#006600; font-weight:bold;">&#40;</span>len = <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">length</span>, fill = <span style="color:#996600;">'.'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    tmp = <span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span>..<span style="color:#9900CC;"><span style="color:#006600; font-weight:bold;">&#40;</span>len<span style="color:#006600; font-weight:bold;">|</span>> <span style="color:#006600; font-weight:bold;">-</span> <span style="color:#006666;">3</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">'...'</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">length</span> <span style="color:#006600; font-weight:bold;">-</span> <span style="color:#006666;">3</span> <span style="color:#006600; font-weight:bold;">&gt;</span> len
    <span style="color:#0000FF; font-weight:bold;">return</span> tmp <span style="color:#006600; font-weight:bold;">||</span> <span style="color:#0000FF; font-weight:bold;">self</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
str = <span style="color:#996600;">&quot;Somereallylongstring&quot;</span>
<span style="color:#CC0066; font-weight:bold;">puts</span> str.<span style="color:#9900CC;">lfill</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
<span style="color:#008000; font-style:italic;">#=&gt; &quot;Somerea...&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.freezzo.com/2009/06/14/how-to-trim-a-string-and-fill-remaining-space-in-ruby/feed/</wfw:commentRss>
		</item>
		<item>
		<title>acts_as_similar - A basic similarity activerecord plugin</title>
		<link>http://www.freezzo.com/2009/06/04/acts_as_similar-a-basic-similarity-activerecord-plugin/</link>
		<comments>http://www.freezzo.com/2009/06/04/acts_as_similar-a-basic-similarity-activerecord-plugin/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 17:34:32 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[activerecord]]></category>

		<category><![CDATA[plugin]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[recommended]]></category>

		<category><![CDATA[similar]]></category>

		<guid isPermaLink="false">http://www.freezzo.com/?p=100</guid>
		<description><![CDATA[I had a need to find items that were similar to an item. I looked at acts_as_recommendable, and while this was very nice plugin, it was too slow when working with large data sets. I also decided that the results I needed didn&#8217;t need to be scientifically accurate, just a rough match. So I created [...]]]></description>
			<content:encoded><![CDATA[<p>I had a need to find items that were similar to an item. I looked at acts_as_recommendable, and while this was very nice plugin, it was too slow when working with large data sets. I also decided that the results I needed didn&#8217;t need to be scientifically accurate, just a rough match. So I created this plugin to allow for a very elementary way to find  items that are similar to the object you are working with. This works best when used with a has_many :through relationship.</p>
<p>Basically all it is doing is looking for other objects of the same class, that have some related value.</p>
<p>Git it here: <a href="http://github.com/freezzo/acts_as_similar/tree/master">http://github.com/freezzo/acts_as_similar/tree/master</a></p>
<p>Example 1<br />
=========<br />
Look for similar playlists, using the videos as what defines similarity.<br />
This will look for all playlists that have a similar video as the playlist you are looking against.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">class</span> Playlist
  has_many <span style="color:#ff3333; font-weight:bold;">:playlists_videos</span>
  has_many <span style="color:#ff3333; font-weight:bold;">:videos</span>, <span style="color:#ff3333; font-weight:bold;">:through</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:playlists_videos</span>
&nbsp;
  acts_as_similar <span style="color:#ff3333; font-weight:bold;">:videos</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Example 2<br />
=========<br />
Look for similar playlists, using the title of the playlist as the similarity item.<br />
This will look for all playlists that have a similar title as the playlist you are looking against.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">class</span> Playlist
  has_many <span style="color:#ff3333; font-weight:bold;">:playlists_videos</span>
  has_many <span style="color:#ff3333; font-weight:bold;">:videos</span>, <span style="color:#ff3333; font-weight:bold;">:through</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:playlists_videos</span>
&nbsp;
  acts_as_similar <span style="color:#ff3333; font-weight:bold;">:field</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:title</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Example 3<br />
=========<br />
Look for similar playlists, using the video_id of the playlists_videos as the similarity item.<br />
This will look for all playlists that have a similar video_id as the playlist you are looking against.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">class</span> Playlist
  has_many <span style="color:#ff3333; font-weight:bold;">:playlists_videos</span>
  has_many <span style="color:#ff3333; font-weight:bold;">:videos</span>, <span style="color:#ff3333; font-weight:bold;">:through</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:playlists_videos</span>
&nbsp;
  acts_as_similar <span style="color:#ff3333; font-weight:bold;">:playlists_videos</span>, <span style="color:#ff3333; font-weight:bold;">:field</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:video_id</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Execute<br />
=========</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#0066ff; font-weight:bold;">@playlist</span> = Playlist.<span style="color:#9900CC;">first</span>
<span style="color:#0066ff; font-weight:bold;">@playlist</span>.<span style="color:#9900CC;">similar</span></pre></div></div>

<p>Note: This is a work in progress.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freezzo.com/2009/06/04/acts_as_similar-a-basic-similarity-activerecord-plugin/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ActiveRecord - Making :include and :select play nice!</title>
		<link>http://www.freezzo.com/2009/05/20/activerecord-making-include-and-select-play-nice/</link>
		<comments>http://www.freezzo.com/2009/05/20/activerecord-making-include-and-select-play-nice/#comments</comments>
		<pubDate>Wed, 20 May 2009 15:00:45 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[activerecord]]></category>

		<category><![CDATA[eager select]]></category>

		<category><![CDATA[include]]></category>

		<guid isPermaLink="false">http://www.freezzo.com/?p=97</guid>
		<description><![CDATA[So I have been using a nice plug-in that will allow me to using :select when using :include, and not have it pull the entire data set. You can add the plug-in to your app like this:

script/plugin install git://github.com/blythedunham/eload-select.git

Here are some ways to use the plug-in:

Employee.find :all,
    :select =&#62; 'addresses.city, address.state, employees.*',
 [...]]]></description>
			<content:encoded><![CDATA[<p>So I have been using a nice plug-in that will allow me to using :select when using :include, and not have it pull the entire data set. You can add the plug-in to your app like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">script<span style="color:#006600; font-weight:bold;">/</span>plugin install git:<span style="color:#006600; font-weight:bold;">//</span>github.<span style="color:#9900CC;">com</span><span style="color:#006600; font-weight:bold;">/</span>blythedunham<span style="color:#006600; font-weight:bold;">/</span>eload<span style="color:#006600; font-weight:bold;">-</span><span style="color:#CC0066; font-weight:bold;">select</span>.<span style="color:#9900CC;">git</span></pre></div></div>

<p>Here are some ways to use the plug-in:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">Employee.<span style="color:#9900CC;">find</span> <span style="color:#ff3333; font-weight:bold;">:all</span>,
    <span style="color:#ff3333; font-weight:bold;">:select</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'addresses.city, address.state, employees.*'</span>,
    <span style="color:#ff3333; font-weight:bold;">:include</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:address</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby">Employee.<span style="color:#9900CC;">find</span> <span style="color:#ff3333; font-weight:bold;">:first</span>,
    <span style="color:#ff3333; font-weight:bold;">:select</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'now() as current_time, addresses.city, DATE(addresses.created_at) as addresses.created_at, employee.*'</span>,
    <span style="color:#ff3333; font-weight:bold;">:include</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:address</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby">Employee.<span style="color:#9900CC;">find</span> <span style="color:#ff3333; font-weight:bold;">:all</span>,
    <span style="color:#ff3333; font-weight:bold;">:select</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'addresses.city, employees.name, employees.start_date'</span>,
    <span style="color:#ff3333; font-weight:bold;">:include</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:address</span></pre></div></div>

<p>Examples taken from:<br />
<a href="http://www.snowgiraffe.com/tech/329/eager-loading-select-plugin-when-select-plays-nice-with-include/">http://www.snowgiraffe.com/tech/329/eager-loading-select-plugin-when-select-plays-nice-with-include/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.freezzo.com/2009/05/20/activerecord-making-include-and-select-play-nice/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Some Possibly less know ActiveRecord configuration options</title>
		<link>http://www.freezzo.com/2009/03/19/some-possibly-less-know-activerecord-configuration-options/</link>
		<comments>http://www.freezzo.com/2009/03/19/some-possibly-less-know-activerecord-configuration-options/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 15:26:28 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[active record]]></category>

		<category><![CDATA[configuration]]></category>

		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.freezzo.com/?p=94</guid>
		<description><![CDATA[I am going to list from the guides.rubyonrails.com site, some possibly less know, but useful configuration options for ruby on rails. I didn&#8217;t know these existed until I had to figure out an elegant way to prefix tables with something, and I didn&#8217;t want to just type it into the migrations and models. Here is [...]]]></description>
			<content:encoded><![CDATA[<p>I am going to list from the guides.rubyonrails.com site, some possibly less know, but useful configuration options for ruby on rails. I didn&#8217;t know these existed until I had to figure out an elegant way to prefix tables with something, and I didn&#8217;t want to just type it into the migrations and models. Here is how you set the variables:</p>
<p>In your config/environments/development.rb (or production.rb, or whatever.rb) do the following:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">config.<span style="color:#9900CC;">active_record</span>.<span style="color:#9900CC;">table_name_prefix</span> = <span style="color:#996600;">&quot;whatever_&quot;</span></pre></div></div>

<p>You can also select any of the following options instead of table_name_prefix to configure active record globally. Here is the list:</p>
<blockquote><p>ActiveRecord::Base includes a variety of configuration options:</p>
<p>    * logger accepts a logger conforming to the interface of Log4r or the default Ruby 1.8.x Logger class, which is then passed on to any new database connections made. You can retrieve this logger by calling logger on either an ActiveRecord model class or an ActiveRecord model instance. Set to nil to disable logging.</p>
<p>    * primary_key_prefix_type lets you adjust the naming for primary key columns. By default, Rails assumes that primary key columns are named id (and this configuration option doesn’t need to be set.) There are two other choices:<br />
          o :table_name would make the primary key for the Customer class customerid<br />
          o :table_name_with_underscore would make the primary key for the Customer class customer_id</p>
<p>    * table_name_prefix lets you set a global string to be prepended to table names. If you set this to northwest_, then the Customer class will look for northwest_customers as its table. The default is an empty string.</p>
<p>    * table_name_suffix lets you set a global string to be appended to table names. If you set this to _northwest, then the Customer class will look for customers_northwest as its table. The default is an empty string.</p>
<p>    * pluralize_table_names specifies whether Rails will look for singular or plural table names in the database. If set to true (the default), then the Customer class will use the customers table. If set to false, then the Customers class will use the customer table.</p>
<p>    * colorize_logging (true by default) specifies whether or not to use ANSI color codes when logging information from ActiveRecord.</p>
<p>    * default_timezone determines whether to use Time.local (if set to :local) or Time.utc (if set to :utc) when pulling dates and times from the database. The default is :local.</p>
<p>    * schema_format controls the format for dumping the database schema to a file. The options are :ruby (the default) for a database-independent version that depends on migrations, or :sql for a set of (potentially database-dependent) SQL statements.</p>
<p>    * timestamped_migrations controls whether migrations are numbered with serial integers or with timestamps. The default is true, to use timestamps, which are preferred if there are multiple developers working on the same application.</p>
<p>    * lock_optimistically controls whether ActiveRecord will use optimistic locking. By default this is true.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.freezzo.com/2009/03/19/some-possibly-less-know-activerecord-configuration-options/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Paperclip and getting the original file path before its uploaded</title>
		<link>http://www.freezzo.com/2009/03/17/paperclip-and-getting-the-original-file-path-before-its-uploaded/</link>
		<comments>http://www.freezzo.com/2009/03/17/paperclip-and-getting-the-original-file-path-before-its-uploaded/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 13:57:28 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[original file]]></category>

		<category><![CDATA[paperclip]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://www.freezzo.com/?p=91</guid>
		<description><![CDATA[Back to some rails stuff. Here is a little tip that helped me out with reading in the file that was being uploaded before I saved the record. I was doing this because I wanted to validate the data in the file before I save the record. Here is what I did:

class SomeModel &#60; ActiveRecord::Base
 [...]]]></description>
			<content:encoded><![CDATA[<p>Back to some rails stuff. Here is a little tip that helped me out with reading in the file that was being uploaded before I saved the record. I was doing this because I wanted to validate the data in the file before I save the record. Here is what I did:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">class</span> SomeModel <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  has_attachment <span style="color:#ff3333; font-weight:bold;">:some_file</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> validate
    file = <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">some_file</span>.<span style="color:#9900CC;">to_file</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:original</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    data = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">read</span><span style="color:#006600; font-weight:bold;">&#40;</span>file<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#008000; font-style:italic;"># Do some validation on data</span>
    errors.<span style="color:#9900CC;">add_to_base</span> <span style="color:#996600;">&quot;File format invalid&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> data.<span style="color:#0000FF; font-weight:bold;">nil</span>?
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.freezzo.com/2009/03/17/paperclip-and-getting-the-original-file-path-before-its-uploaded/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Facebook and CPA.. will it work?</title>
		<link>http://www.freezzo.com/2009/03/16/facebook-and-cpa-will-it-work/</link>
		<comments>http://www.freezzo.com/2009/03/16/facebook-and-cpa-will-it-work/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 18:38:36 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
		
		<category><![CDATA[Affiliate Marketing]]></category>

		<guid isPermaLink="false">http://www.freezzo.com/?p=87</guid>
		<description><![CDATA[Hey all. I&#8217;m still having a try at the affiliate marketing stuff. I just signed up with Facebook Advertising to try my hand at that.
I have decided I was going to try and use the targeting in Facebook to help show my ad to ONLY those I want interested in the offer. The setup was [...]]]></description>
			<content:encoded><![CDATA[<p>Hey all. I&#8217;m still having a try at the affiliate marketing stuff. I just signed up with Facebook Advertising to try my hand at that.<br />
I have decided I was going to try and use the targeting in Facebook to help show my ad to ONLY those I want interested in the offer. The setup was pretty easy, and once I figured out what Facebook wanted for criteria, it was easy to get them approved. Normally I go with the CPC model, but with Facebook, I am trying the CPM model. So far it seems to be rather cost effective. So far I haven&#8217;t made a conversion yet, but it is still the beginning.<br />
I will keep you tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freezzo.com/2009/03/16/facebook-and-cpa-will-it-work/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
