<?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>Pedro Pimentel &#187; ruby</title>
	<atom:link href="http://www.pedropimentel.com/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pedropimentel.com</link>
	<description>Ruby on Rails Evangelist</description>
	<lastBuildDate>Thu, 29 Jul 2010 14:51:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Method dispatch in Ruby</title>
		<link>http://www.pedropimentel.com/2009/12/15/method-dispatch-in-ruby/</link>
		<comments>http://www.pedropimentel.com/2009/12/15/method-dispatch-in-ruby/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 20:38:11 +0000</pubDate>
		<dc:creator>Pedro Pimentel</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[dispatcher]]></category>
		<category><![CDATA[interpreter]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[mri]]></category>

		<guid isPermaLink="false">http://www.pedropimentel.com/?p=194</guid>
		<description><![CDATA[
Some days ago I was asked how the dispatcher works in ruby and I was caught in surprise I didn&#8217;t know how to explain the method dispatching in the language we love (Ruby). That question was kept still in my mind for a few days but while listening to some workmates discussing about singleton classes [...]


Probably Related posts:<ol><li><a href='http://www.pedropimentel.com/2008/10/01/how_to_run_just_one_test_from_your_terminal/' rel='bookmark' title='Permanent Link: How to Run Just one Test Method from your Terminal'>How to Run Just one Test Method from your Terminal</a></li>
<li><a href='http://www.pedropimentel.com/2008/07/28/writing-optioned-software/' rel='bookmark' title='Permanent Link: Writing Opinionated Software'>Writing Opinionated Software</a></li>
<li><a href='http://www.pedropimentel.com/2010/07/29/how-do-i-keep-track-of-what-ive-learnt/' rel='bookmark' title='Permanent Link: How do I keep Track of what I&#8217;ve learnt'>How do I keep Track of what I&#8217;ve learnt</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.pedropimentel.com/wp-content/uploads/2009/12/pomegranate.jpg"><img class="size-medium wp-image-195 aligncenter" title="pomegranate" src="http://www.pedropimentel.com/wp-content/uploads/2009/12/pomegranate-311x450.jpg" alt="pomegranate" width="311" height="450" /></a></p>
<p>Some days ago I was asked how the dispatcher works in ruby and I was caught in surprise I didn&#8217;t know how to explain the method dispatching in the language we love (Ruby). That question was kept still in my mind for a few days but while listening to some workmates discussing about singleton classes in ruby the answer came to my mind in a blink of eyes reminding me from a university class which I had a long time ago about how method dispatching works in dynamic languages like Ruby.</p>
<p>So with that information in mind and some googling to confirm it I came out with a simple explanation of how the dispatching works in Ruby and decided it&#8217;s worth sharing you.</p>
<p>Essentially for each method call in ruby, the language interpreter checks in the inheritance hierarchy of the classes of the receiver (in our case &#8220;<em>my_string</em>&#8220;) to determine which method should be executed.</p>
<p>An example:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  my_string = <span style="color:#CC00FF; font-weight:bold;">Hash</span>.<span style="color:#9900CC;">new</span> <span style="color:#008000; font-style:italic;"># =&gt; {}</span>
  my_string.<span style="color:#9900CC;">size</span>  <span style="color:#008000; font-style:italic;"># =&gt; 0</span></pre></div></div>

<p>The code above is pretty simple but what&#8217;s important is happening beneath of it. The language interpreter is assigning the variable “<em>my_string</em>” with an instance of the Hash class then it&#8217;s calling the method “<em>size</em>”.</p>
<p>The Hash class is where our interpreter will start searching for the “<em>size</em>” method, if the interpreter doesn&#8217;t find the method in the Hash class, it&#8217;ll continue to search in the Hash parent class, which in our case (Ruby) is the topmost class . It can be the case the interpreter don&#8217;t find  the method “<em>size</em>”, so it&#8217;ll throw a “<em>method missing</em>” exception. In our example, the Hash class contains the “<em>size</em>” method and successfully returns.</p>
<p>If you want to know how MRI&#8217;s (Matz&#8217;s Ruby Interpreter) implements method dispatch, I recommend you to take a look in<a title="Patrick Farley" href="http://www.klankboomklang.com/2007/09/14/method-dispatch/" target="_blank"> this blog post by Patrick Farley</a>, where he explains the Ruby source code responsible for handling method dispatch.</p>
<p>For even further information on this matter there is this huge and excelent <a title="Russ Olsen" href="http://www.jroller.com/rolsen/entry/ruby_spin_up_where_did" target="_blank">post from Russ Olsen</a>, author of the book Design Patterns in Ruby.</p>


<p>Probably Related posts:<ol><li><a href='http://www.pedropimentel.com/2008/10/01/how_to_run_just_one_test_from_your_terminal/' rel='bookmark' title='Permanent Link: How to Run Just one Test Method from your Terminal'>How to Run Just one Test Method from your Terminal</a></li>
<li><a href='http://www.pedropimentel.com/2008/07/28/writing-optioned-software/' rel='bookmark' title='Permanent Link: Writing Opinionated Software'>Writing Opinionated Software</a></li>
<li><a href='http://www.pedropimentel.com/2010/07/29/how-do-i-keep-track-of-what-ive-learnt/' rel='bookmark' title='Permanent Link: How do I keep Track of what I&#8217;ve learnt'>How do I keep Track of what I&#8217;ve learnt</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.pedropimentel.com/2009/12/15/method-dispatch-in-ruby/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Run Just one Test Method from your Terminal</title>
		<link>http://www.pedropimentel.com/2008/10/01/how_to_run_just_one_test_from_your_terminal/</link>
		<comments>http://www.pedropimentel.com/2008/10/01/how_to_run_just_one_test_from_your_terminal/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 01:45:07 +0000</pubDate>
		<dc:creator>Pedro Pimentel</dc:creator>
				<category><![CDATA[hints]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby test]]></category>

		<guid isPermaLink="false">http://www.pedropimentel.com/?p=75</guid>
		<description><![CDATA[Many times I found myself running all tests just after modifying just one test method. Depending on the size of your project and its test ratio, it can be a very boring waiting for it to finish.
It can be even worse: Imagine you have other tests failing. How can you improve your productivity ?  Just [...]


Probably Related posts:<ol><li><a href='http://www.pedropimentel.com/2009/12/15/method-dispatch-in-ruby/' rel='bookmark' title='Permanent Link: Method dispatch in Ruby'>Method dispatch in Ruby</a></li>
<li><a href='http://www.pedropimentel.com/2008/07/28/writing-optioned-software/' rel='bookmark' title='Permanent Link: Writing Opinionated Software'>Writing Opinionated Software</a></li>
<li><a href='http://www.pedropimentel.com/2009/03/22/view-sql-queries-in-your-console/' rel='bookmark' title='Permanent Link: View sql queries in your console'>View sql queries in your console</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Many times I found myself running all tests just after modifying just one test method. Depending on the size of your project and its test ratio, it can be a very boring waiting for it to finish.</p>
<p>It can be even worse: Imagine you have other tests failing. How can you improve your productivity ?  Just use the &#8220;-n method_name&#8221; parameter for the method you want to test.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ruby path_to_your_test_case <span style="color: #660033;">-n</span> method_you_want_to_test</pre></div></div>

<p>A real example, I want to test the &#8220;test_should_do_stuff&#8221; method inside my &#8220;stuff_controller_test.rb&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ruby test<span style="color: #000000; font-weight: bold;">/</span>functional<span style="color: #000000; font-weight: bold;">/</span>stuff_controller_test.rb <span style="color: #660033;">-n</span> test_should_do_stuff</pre></div></div>

<p>Worth remember that stills load your fixtures and preforms setup, it only won&#8217;t execute the other test methods.</p>


<p>Probably Related posts:<ol><li><a href='http://www.pedropimentel.com/2009/12/15/method-dispatch-in-ruby/' rel='bookmark' title='Permanent Link: Method dispatch in Ruby'>Method dispatch in Ruby</a></li>
<li><a href='http://www.pedropimentel.com/2008/07/28/writing-optioned-software/' rel='bookmark' title='Permanent Link: Writing Opinionated Software'>Writing Opinionated Software</a></li>
<li><a href='http://www.pedropimentel.com/2009/03/22/view-sql-queries-in-your-console/' rel='bookmark' title='Permanent Link: View sql queries in your console'>View sql queries in your console</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.pedropimentel.com/2008/10/01/how_to_run_just_one_test_from_your_terminal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RailsConf Europe 2008 &#8211; Primeiro Dia</title>
		<link>http://www.pedropimentel.com/2008/09/03/railsconf-europe-2008-primeiro-dia/</link>
		<comments>http://www.pedropimentel.com/2008/09/03/railsconf-europe-2008-primeiro-dia/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 15:37:20 +0000</pubDate>
		<dc:creator>Pedro Pimentel</dc:creator>
				<category><![CDATA[events]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[dhh]]></category>
		<category><![CDATA[railsconf]]></category>

		<guid isPermaLink="false">http://www.pedropimentel.com/?p=69</guid>
		<description><![CDATA[
Ontem foi o Tutorials`s Day da RailsConf, mas só hoje que começou oficialmente a RailsConf Europe. Este ano tendo a presença do criador do framework Rails, (David Heinemeier Hansson) para apresentar o Keynote de kick-off da conferência.
No keynote, David falou sobre código legado. A primeira parte da palestra teve um tom mais filosófico, que tem [...]


Probably Related posts:<ol><li><a href='http://www.pedropimentel.com/2008/08/20/portal-uca/' rel='bookmark' title='Permanent Link: Portal UCA'>Portal UCA</a></li>
<li><a href='http://www.pedropimentel.com/2008/06/02/open-source-rails/' rel='bookmark' title='Permanent Link: Open Source Rails'>Open Source Rails</a></li>
<li><a href='http://www.pedropimentel.com/2008/01/22/i18n/' rel='bookmark' title='Permanent Link: Internacionalizando uma aplicação rails'>Internacionalizando uma aplicação rails</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.pedropimentel.com/wp-content/uploads/2008/09/p1010477.jpg"><img class="size-medium wp-image-71" title="Black" src="http://www.pedropimentel.com/wp-content/uploads/2008/09/p1010477-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>Ontem foi o Tutorials`s Day da RailsConf, mas só hoje que começou oficialmente a RailsConf Europe. Este ano tendo a presença do criador do framework Rails, (<span class="description">David Heinemeier Hansson) para apresentar o Keynote de kick-off da conferência.</span></p>
<p>No keynote, David falou sobre código legado. A primeira parte da palestra teve um tom mais filosófico, que tem sido (em minha opinião) uma presença cada vez mais constante nas apresentações do David. Ele comentou sobre a importância de termos código legado, que segundo ele, um bom programador é um bom programador se ele tiver escrito bastante código legado. É impossível escrever código que não se torne legado, por isso David defende que código legado deve ser mudado lentamente, sempre que for preciso corrigir algum bug ou implementar uma nova funcionalidade em um código legado, você deve aproveitar a oportunidade para deixar o código melhor e mais bonito. Durante a apresentação ele mostrou exemplos práticos de como refator código legado. O legal foi que ele mostrou isso, usando o código do Basecamp, que é a primeira aplicação feita em Rails, logo código mais legado que isso não tem heheh. Ele comentou sobre a importância de saber onde colocar as coisas em sua aplicação, dando exemplos do que tinha no Basecamp, como um Global Controller, que agregava muitos métodos que só foram parar lá por não saber onde colocar.</p>
<p style="text-align: center;"><a href="http://www.pedropimentel.com/wp-content/uploads/2008/09/p1010480.jpg"><img class="size-medium wp-image-72" title="Slide do DHH" src="http://www.pedropimentel.com/wp-content/uploads/2008/09/p1010480-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>Logo em seguida, foi o break e aproveitei pra conhecer pessoalmente o <a title="Michael Korziarki `s blog" href="http://www.koziarski.net/" target="_blank">Michael Koziarski</a> que é um dos membros do core team do Rails. Ele é um cara bastante acessível e conversamos sobre o RailsSummit no Brasil. Ele disse que adoraria participar do RailsSummit, mas que tem viajado demais e não iria poder comparecer.</p>
<p>Após o break, escolhi ir na palestra &#8220;Hacking the mid-end: Unobtrusive Scripting and advanced UI techniques in Rails&#8221; apresentada pelo <a title="Intridea Website" href="http://intridea.com/" target="_blank">Michael Bleigh e Chris Selmer</a>, ambos da Intridea. Eles apresentaram, em dois casos de uso, como usar Jquery e comportamento lowpro para manter separados comportamento (funcionamento) e markup de uma aplicação. Basicamente, os dois exemplos trataram de garantir o funcionamento da aplicação com e sem javascript, sem colocar lógica nos views.</p>
<p><a href="http://www.pedropimentel.com/wp-content/uploads/2008/09/picture-1.png"></a>Em seguida, assisti a palestra &#8220;Rails Software Metrics&#8221; feita <a title="Roderick`s site" href="http://www.nedforce.nl/" target="_blank">Roderick Van Domburg</a> da Nedforce, uma empresa holandesa de solucões Rails. Foi apresentado um conjunto de ferramentas para analisar a sua aplicação em termos de métricas de software. Flog, que é uma gem para auxiliar refactoring, falu do Rcov e seu plugin para rails, do Heckle que parece bem legal, pois ele além de analisar a cobertura de testes em sua aplicação, também altera o código dinamicamente. Lembro de ter visto algo parecido em uma palestra chamada &#8220;Machucando seu código&#8221; que o Fábio Akita disponibilizou traduzida em seu blog. Terminou a palestra comentando sobre o metrics_fu, que são um conjunto de tarefas Rake para usar com o software de integração CruiseControl.rb. Fiquei surpreso com a quantidade de pessoas que disseram usar CruiseControl, assim que possível vou dar uma atenção a isso. É claro que todas essas técnicas de medição de software não valem nada se você não definir metas e procedimentos para analisar elas, caso contrário, serão somente números soltos.</p>
<p style="text-align: center;"><img class="size-medium wp-image-70" title="DHH e eu" src="http://www.pedropimentel.com/wp-content/uploads/2008/09/picture-1-300x218.png" alt="DHH e eu" width="300" height="218" /></p>
<p>Após o almoço, assisti &#8220;Intellectual Scalability &#8211; Solving a large problem with multiple  cooperating rails apps&#8221; dada por <a title="Texperts website" href="http://www.texperts.com/" target="_blank">Frederick Cheung e Paul Butcher, ambos da Texperts</a>. Apresentaram um caso de uso real enfretado por eles na Texperts, onde eles precisaram encontrar uma solução escalável para uma aplicação que iria crescer muito.  A solução (muito semelhante a usar Rails Engines) consistiu em dividir a funcionalidade entre diveras pequenas aplicações. Certo, mas como eles fizeram isso ? Eles mostraram com uma aplicação bem simples o funcionamento do &#8220;framework&#8221; próprio criado por eles para encarar o problema. Foi uma palestra bem técnica, com bastante código sendo feito ao vivo. Gostei bastante.</p>
<p>Em seguida, não havia nenhum assunto que me interasse e acabei assistindo &#8220;Scaffolding an application from schema.rb&#8221; dada por <a title="Tomaso Minelli" href="http://homes.stat.unipd.it/minni" target="_blank">Tomaso Minelli</a>. O Tomaso é Italiano e tinha um sotaque carregado, que deixou a palestra um tanto &#8220;arrastada&#8221;. Foi uma palestra bem iniciante, onde ele apresentous as principais soluções de scaffolding do mercado e apresentou sua própria solucação de scaffolding que é apartir do schema.rb. Ele basicamente redefiniu o método ActiveRecord::Schema.define.</p>
<p>A última palestra o dia foi &#8220;Stories on a cloud &#8211; Distributed browser testing with selenium&#8221; dada pelo <a title="Beyond the type" href="http://www.beyondthetype.com/" target="_blank">Martin Sadler</a>. Com o javascript cada vez mais sendo usado hoje em dia, é preciso termos como garantir que nossas aplicações funcionem bem independente de navegador ou sistema operacional. Ele mostrou o<a title="webrat" href="http://agilewebdevelopment.com/plugins/webrat" target="_blank"> Webrat</a> e RSpec Stories, e logo em seguida mostrou como unir o melhor de cada um atrelando a um servidor Selenium distribuído em vários computadores usando um sistema de mensagens para executar os testes em cada computador. Foi bem bacana, só faltou um exemplo ao vivo pra me convencer.</p>
<p>No momento que escrevo este post, Jeremy Kemper, outro membro do core team, está dando um keynote de encerramento. Se for legal, posto o que ele falou mais tarde.</p>
<p>=D</p>


<p>Probably Related posts:<ol><li><a href='http://www.pedropimentel.com/2008/08/20/portal-uca/' rel='bookmark' title='Permanent Link: Portal UCA'>Portal UCA</a></li>
<li><a href='http://www.pedropimentel.com/2008/06/02/open-source-rails/' rel='bookmark' title='Permanent Link: Open Source Rails'>Open Source Rails</a></li>
<li><a href='http://www.pedropimentel.com/2008/01/22/i18n/' rel='bookmark' title='Permanent Link: Internacionalizando uma aplicação rails'>Internacionalizando uma aplicação rails</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.pedropimentel.com/2008/09/03/railsconf-europe-2008-primeiro-dia/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Writing Opinionated Software</title>
		<link>http://www.pedropimentel.com/2008/07/28/writing-optioned-software/</link>
		<comments>http://www.pedropimentel.com/2008/07/28/writing-optioned-software/#comments</comments>
		<pubDate>Tue, 29 Jul 2008 01:30:27 +0000</pubDate>
		<dc:creator>Pedro Pimentel</dc:creator>
				<category><![CDATA[personal]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[trends]]></category>

		<guid isPermaLink="false">http://www.pedropimentel.com/?p=50</guid>
		<description><![CDATA[Sometimes I got myself thinking what makes a software have its own opinion and be considered &#8220;optioned software&#8221;. Would it be related to the language philosophy or to the programmer itself, or both of them?
People usually say Rails is a good example of optioned software. I can say I take part of the same opinion, [...]


Probably Related posts:<ol><li><a href='http://www.pedropimentel.com/2008/06/09/rails-21-whats-new/' rel='bookmark' title='Permanent Link: RELEASED &#8211; &#8220;Rails 2.1 &#8211; What`s new ?&#8221; Book'>RELEASED &#8211; &#8220;Rails 2.1 &#8211; What`s new ?&#8221; Book</a></li>
<li><a href='http://www.pedropimentel.com/2008/04/17/fisl-90-primeiro-dia/' rel='bookmark' title='Permanent Link: FISL 9.0 &#8211; First day'>FISL 9.0 &#8211; First day</a></li>
<li><a href='http://www.pedropimentel.com/2008/06/15/ultrasphinx-bug/' rel='bookmark' title='Permanent Link: Ultrasphinx bug?'>Ultrasphinx bug?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Sometimes I got myself thinking what makes a software have its own opinion and be considered &#8220;optioned software&#8221;. Would it be related to the language philosophy or to the programmer itself, or both of them?</p>
<p>People usually say <strong>Rails</strong> is a good example of optioned software. I can say I take part of the same opinion, but I&#8217;d like to take this point a little more further by not emphasizing only the software, but the programmer and how its culture could be incorporated (and not avoided) in the software it produces.</p>
<p>Out there, in the software market, when hiring people, companies usually claim they give plenty of room for people to innovate, share ideas and try new things and all that cool stuff we usually hear from Googles&#8217;s employees about independence and space to build your own skills and develop ideas within the job. But what we found <strong>most</strong> in the reality is the same <em>copy &amp; paste</em> philosophy everywhere. The programmer usually don&#8217;t have time to try new things, because he is stuck with a pile of tedious tasks to complete and the deliverable is always behind schedule, which appears to be a endless cycle, project after project.</p>
<p>I believe, <strong>Ruby on Rails</strong> came to &#8220;save&#8221; the people from these kind of starving companies, which likes to hire young and &#8220;virgin&#8221; employees to mold them to the &#8220;Software Factory&#8221; style. Ruby on Rails lets the programmer surpass most of the tedious tasks, so it lets the programmer have free time to innovate in other areas of the software. It depends, of course, on the company philosophy, but when companies envise the real profit they can benefit from having a happy employee and tailoring the software for the user real needs, the companies will would like to have adopted the Ruby on Rails earlier.</p>
<p>Ok, but where the programmer opinion comes in ? I strongly believe by having more time to think, the programmer can not only fix issues, but can also suggest new features, test and present them very quickly and best of all, he also can earn more as people usually like to pay for what&#8217;s well done.</p>
<p>All in all, writing optioned software is not about yelling what&#8217; s your favorite band, but it&#8217;s all about programming and being happy.  <strong>I am a happy programmer and you ??</strong></p>
<p><strong>[update 08-01]</strong> Thanks Soleone for your suggestion</p>


<p>Probably Related posts:<ol><li><a href='http://www.pedropimentel.com/2008/06/09/rails-21-whats-new/' rel='bookmark' title='Permanent Link: RELEASED &#8211; &#8220;Rails 2.1 &#8211; What`s new ?&#8221; Book'>RELEASED &#8211; &#8220;Rails 2.1 &#8211; What`s new ?&#8221; Book</a></li>
<li><a href='http://www.pedropimentel.com/2008/04/17/fisl-90-primeiro-dia/' rel='bookmark' title='Permanent Link: FISL 9.0 &#8211; First day'>FISL 9.0 &#8211; First day</a></li>
<li><a href='http://www.pedropimentel.com/2008/06/15/ultrasphinx-bug/' rel='bookmark' title='Permanent Link: Ultrasphinx bug?'>Ultrasphinx bug?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.pedropimentel.com/2008/07/28/writing-optioned-software/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ultrasphinx bug?</title>
		<link>http://www.pedropimentel.com/2008/06/15/ultrasphinx-bug/</link>
		<comments>http://www.pedropimentel.com/2008/06/15/ultrasphinx-bug/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 20:28:06 +0000</pubDate>
		<dc:creator>Pedro Pimentel</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[ultrasphinx]]></category>

		<guid isPermaLink="false">http://www.pedropimentel.com/2008/06/15/ultrasphinx-bug/</guid>
		<description><![CDATA[It seens Ultrasphinx plugin for Ruby on Rails doesn&#8217;t know how to deal with Decimal data type from MySQL.
You can use a Decimal column for indexing, but when you need to make thecolumn sortable it comes the problem. As you know, faceting is on for numeric and date fields and to add the sortable feature [...]


Probably Related posts:<ol><li><a href='http://www.pedropimentel.com/2009/03/22/view-sql-queries-in-your-console/' rel='bookmark' title='Permanent Link: View sql queries in your console'>View sql queries in your console</a></li>
<li><a href='http://www.pedropimentel.com/2008/09/03/railsconf-europe-2008-primeiro-dia/' rel='bookmark' title='Permanent Link: RailsConf Europe 2008 &#8211; Primeiro Dia'>RailsConf Europe 2008 &#8211; Primeiro Dia</a></li>
<li><a href='http://www.pedropimentel.com/2008/06/09/rails-21-whats-new/' rel='bookmark' title='Permanent Link: RELEASED &#8211; &#8220;Rails 2.1 &#8211; What`s new ?&#8221; Book'>RELEASED &#8211; &#8220;Rails 2.1 &#8211; What`s new ?&#8221; Book</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>It seens Ultrasphinx plugin for Ruby on Rails doesn&#8217;t know how to deal with Decimal data type from MySQL.</p>
<p>You can use a Decimal column for indexing, but when you need to make thecolumn sortable it comes the problem. As you know, faceting is on for numeric and date fields and to add the sortable feature to it, we need to pass a hash with</p>
<pre>{:sortable =&gt; true}
</pre>
<p>Ok, then you run rake tasks to rebuild your configuration file and indexes and try to sort the search by the Decimal column and we got an error saying our column isn&#8217;t sortable.</p>
<p>You can check isn&#8217;t generating the _sortable sufix by looking the ultrasphinx configuration file. All other sortable fields have their _sortable sufix added to ti, except by the decimal field.</p>
<p>I&#8217;ll report it as soon as possible to Evan Weaver, the plugin&#8217;s owner, or maybe try to fix it by myself.</p>
<p><strong>Updated: June, 16</strong></p>
<p>I fixed by adding  &#8216;decimal&#8217; =&gt; &#8216;float&#8217; in the TYPE_MAP inside the fields.rb file of ultrasphinx plugin.</p>


<p>Probably Related posts:<ol><li><a href='http://www.pedropimentel.com/2009/03/22/view-sql-queries-in-your-console/' rel='bookmark' title='Permanent Link: View sql queries in your console'>View sql queries in your console</a></li>
<li><a href='http://www.pedropimentel.com/2008/09/03/railsconf-europe-2008-primeiro-dia/' rel='bookmark' title='Permanent Link: RailsConf Europe 2008 &#8211; Primeiro Dia'>RailsConf Europe 2008 &#8211; Primeiro Dia</a></li>
<li><a href='http://www.pedropimentel.com/2008/06/09/rails-21-whats-new/' rel='bookmark' title='Permanent Link: RELEASED &#8211; &#8220;Rails 2.1 &#8211; What`s new ?&#8221; Book'>RELEASED &#8211; &#8220;Rails 2.1 &#8211; What`s new ?&#8221; Book</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.pedropimentel.com/2008/06/15/ultrasphinx-bug/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
