<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>ruby &amp; rails developer, freelance, *nix lover, teacher</description><title>Andrea Pavoni (apeacox)</title><generator>Tumblr (3.0; @andreapavoni)</generator><link>http://andreapavoni.tumblr.com/</link><item><title>Moving this blog to my home</title><description>&lt;p&gt;Hi there!&lt;/p&gt;
&lt;p&gt;Just for the record, my new blog/website is &lt;a href="http://andreapavoni.com" target="_self"&gt;&lt;a href="http://andreapavoni.com"&gt;http://andreapavoni.com&lt;/a&gt;&lt;/a&gt;. I&amp;#8217;ve also moved some technical posts there.&lt;/p&gt;
&lt;p&gt;cheers,&lt;/p&gt;
&lt;p&gt;A.&lt;/p&gt;</description><link>http://andreapavoni.tumblr.com/post/19291019978</link><guid>http://andreapavoni.tumblr.com/post/19291019978</guid><pubDate>Wed, 14 Mar 2012 16:03:44 +0100</pubDate></item><item><title>Billy listens to Vivaldi music</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lwtasr1fgu1qb3hqzo1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;span&gt;Billy listens to Vivaldi music&lt;/span&gt;&lt;/p&gt;</description><link>http://andreapavoni.tumblr.com/post/14808618237</link><guid>http://andreapavoni.tumblr.com/post/14808618237</guid><pubDate>Mon, 26 Dec 2011 14:00:00 +0100</pubDate></item><item><title>Store Rails views on database</title><description>&lt;p&gt;When it comes to develop a CMS, one of the main problems concerns &lt;em&gt;where or how&lt;/em&gt; to store and organize views (templates, partials, layouts) for particular needs like different layouts for specific pages, (sub)domains or multi-languages. The ideal way is to store views on a database, indeed there are some CMSs that solve this problem with similar approaches, like &lt;a title="Radiant CMS" href="http://radiantcms.org"&gt;Radiant&lt;/a&gt; and &lt;a title="Locomotive" href="http://www.locomotivecms.com/"&gt;Locomotive&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;However, I wanted something that let me to reuse this feature on several projects (because a custom CMS may have different features), and to store &lt;em&gt;only certain views&lt;/em&gt;, according to specific content and needs.&lt;/p&gt;
&lt;p&gt;So, I&amp;#8217;ve developed &lt;a title="Panoramic: store rails views on database" href="https://github.com/apeacox/panoramic"&gt;Panoramic&lt;/a&gt;, a simple gem inspired from some ideas found in José Valim&amp;#8217;s excellent book &lt;a title="José Valim: Crafting Rails Applications" href="http://pragprog.com/titles/jvrails/crafting-rails-applications"&gt;Crafting Rails Applications&lt;/a&gt;. Simply put, once Panoramic is installed, you can store your views on database. It works through an implemetation of ActionView::Resolver class: Rails will lookup views as if they were on filesystem. In controller, you&amp;#8217;ll tell where and when to use those views, using prepend&lt;em&gt;_view_path&lt;/em&gt; and append&lt;em&gt;_view_path&lt;/em&gt; on a controller or action basis (they are both implemented as class and instance methods). Depending from the method you&amp;#8217;ll use, Rails will respectively look for views on database, then it will fallback on filesystem, or viceversa. Quite easy, right?&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ll not show any code here, because there&amp;#8217;s a full explanation on &lt;a href="https://github.com/apeacox/panoramic/blob/master/README.md"&gt;Panoramic&amp;#8217;s README&lt;/a&gt;. As a final note, at the moment it works only with ActiveRecord, but I&amp;#8217;ve planned to extend support to DataMapper and Mongoid as soon as possible. It&amp;#8217;s very easy to implement, the main problem is about testing: maybe I&amp;#8217;ll write some rspec&amp;#8217;s custom matchers to reuse with different ORMs, like &lt;a title="carrierwave: rails file uploads" href="https://github.com/jnicklas/carrierwave"&gt;carrierwave&lt;/a&gt;.&lt;/p&gt;</description><link>http://andreapavoni.tumblr.com/post/6488774753</link><guid>http://andreapavoni.tumblr.com/post/6488774753</guid><pubDate>Mon, 13 Jun 2011 17:05:00 +0200</pubDate><category>ruby</category><category>rails</category><category>templates</category><category>gem</category></item><item><title>hackitaly:

Il nuovo video di Hackitaly. Stay Tuned per il...</title><description>&lt;iframe width="400" height="243" src="http://www.youtube.com/embed/kaKn_713pr0?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a href="http://hackitaly.org/post/3707973339"&gt;hackitaly&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Il nuovo video di Hackitaly. Stay Tuned per il prossimo evento&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://andreapavoni.tumblr.com/post/3742842068</link><guid>http://andreapavoni.tumblr.com/post/3742842068</guid><pubDate>Wed, 09 Mar 2011 15:41:41 +0100</pubDate></item><item><title>hackitaly:

Con tutto il rispetto al buon Saviano che ci ha...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lhh7ypTdff1qgpysmo1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a href="http://hackitaly.org/post/3618028195/antonio-trapani-in-copertina-di-wired-per-i-150-anni"&gt;hackitaly&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Con tutto il rispetto al buon Saviano che ci ha fatto piangere e sognare con i suoi libri e le sue trasmissioni televisive , noi di Hackitaly pensiamo che l’Italia debba ricominciare da persone come ANTONIO TRAPANI , hacker e developer di Hackitaly .&lt;/p&gt;
&lt;p&gt;E da tutti gli startupper e developers italiani .&lt;/p&gt;
&lt;p&gt;E non da qui &lt;a href="http://mag.wired.it/rivista/storie/la-rivoluzione-secondo-roberto-saviano.html"&gt;&lt;a href="http://mag.wired.it/rivista/storie/la-rivoluzione-secondo-roberto-saviano.html"&gt;http://mag.wired.it/rivista/storie/la-rivoluzione-secondo-roberto-saviano.html&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;ANTONIO, grazie di esistere, e grazie per quello che stai facendo per l’Italia, probabilmente la copertina di Wired non avrai mai pensato di averla.&lt;/p&gt;
&lt;p&gt;Ma noi te l’abbiamo data e secondo noi questa è la più bella di tutte.&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://andreapavoni.tumblr.com/post/3618874587</link><guid>http://andreapavoni.tumblr.com/post/3618874587</guid><pubDate>Thu, 03 Mar 2011 12:54:57 +0100</pubDate></item><item><title>The Ruby Mine: Ecco i talk del #rsc Milano</title><description>&lt;a href="http://therubymine.tumblr.com/post/3442324830"&gt;The Ruby Mine: Ecco i talk del #rsc Milano&lt;/a&gt;: &lt;p&gt;&lt;a href="http://therubymine.tumblr.com/post/3442324830" class="tumblr_blog"&gt;therubymine&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;Bene ragazzi, &lt;/span&gt;&lt;/p&gt;
&lt;span&gt;le 3 presentazioni di giovedì sera sono ormai definite, ma per chi volesse possiamo &lt;/span&gt;aggiungerne una quarta, se mai qualcuno avesse qualche nuova cosa da far vedere.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Giordano Scalzo&lt;/strong&gt;. Ci parlerà di &lt;a target="_blank" href="https://github.com/jnunemaker/mongomapper/"&gt;mongo&lt;/a&gt; &lt;a target="_blank" href="http://railstips.org/blog/labels/mongomapper/"&gt;mapper&lt;/a&gt;, un wrapper ruby che ci permette di usare&lt;a target="_blank" href="http://www.mongodb.org/"&gt;MongoDB&lt;/a&gt;, cercando di…&lt;/blockquote&gt;</description><link>http://andreapavoni.tumblr.com/post/3444458506</link><guid>http://andreapavoni.tumblr.com/post/3444458506</guid><pubDate>Tue, 22 Feb 2011 15:18:22 +0100</pubDate></item><item><title>The Ruby Mine: Ruby Social Club: Roma, 4 Marzo 2011</title><description>&lt;a href="http://therubymine.tumblr.com/post/3290446966"&gt;The Ruby Mine: Ruby Social Club: Roma, 4 Marzo 2011&lt;/a&gt;: &lt;p&gt;&lt;a href="http://therubymine.tumblr.com/post/3290446966"&gt;therubymine&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;La comunità italiana di Ruby è attiva come non mai!&lt;/p&gt;
&lt;p&gt;Dopo aver iniziato un progetto di beneficenza (&lt;a href="http://italianvalley.wired.it/blog/startup_cloud/hack-for-school-sviluppare-un-progetto-open-source-attraverso-la-community-ruby-e-agile.html"&gt;Hack for School&lt;/a&gt;) e gettato le basi per la prima &lt;a href="http://rubyday.it/"&gt;Ruby conference&lt;/a&gt; nazionale, siamo lieti di annunciare il ritorno dei &lt;a href="http://ruby-it.org/pages/Ruby+Social+Club"&gt;Ruby Social Club&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In occasione del primo &lt;a href="http://www.codemotion.it/"&gt;Codemotion&lt;/a&gt; ci ritroveremo tutti…&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://andreapavoni.tumblr.com/post/3290547439</link><guid>http://andreapavoni.tumblr.com/post/3290547439</guid><pubDate>Mon, 14 Feb 2011 12:16:05 +0100</pubDate></item><item><title>Live pics from @hackitaly </title><description>&lt;p&gt;&lt;a href="http://hackitaly.org/post/3123001212/hackitaly-pics"&gt;hackitaly&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;
&lt;object height="375" width="500"&gt;
&lt;param value="offsite=true&amp;amp;lang=en-us&amp;amp;page_show_url=%2Fphotos%2F48588281%40N07%2Fsets%2F72157625855787141%2Fshow%2F&amp;amp;page_show_back_url=%2Fphotos%2F48588281%40N07%2Fsets%2F72157625855787141%2F&amp;amp;set_id=72157625855787141&amp;amp;jump_to=" name="flashvars"&gt;&lt;param value="http://www.flickr.com/apps/slideshow/show.swf?v=71649" name="movie"&gt;&lt;param value="true" name="allowFullScreen"&gt;&lt;embed height="375" width="500" flashvars="offsite=true&amp;amp;lang=en-us&amp;amp;page_show_url=%2Fphotos%2F48588281%40N07%2Fsets%2F72157625855787141%2Fshow%2F&amp;amp;page_show_back_url=%2Fphotos%2F48588281%40N07%2Fsets%2F72157625855787141%2F&amp;amp;set_id=72157625855787141&amp;amp;jump_to=" allowfullscreen="true" src="http://www.flickr.com/apps/slideshow/show.swf?v=71649" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://andreapavoni.tumblr.com/post/3143585469</link><guid>http://andreapavoni.tumblr.com/post/3143585469</guid><pubDate>Sun, 06 Feb 2011 14:53:13 +0100</pubDate></item><item><title>Coderloop's blog: Riding Rails 3</title><description>&lt;a href="http://blog.coderloop.com/post/2819118842/riding-rails-3"&gt;Coderloop's blog: Riding Rails 3&lt;/a&gt;: &lt;p&gt;yeah, it was funny!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.coderloop.com/post/2819118842/riding-rails-3"&gt;coderloop&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;126 commits&lt;/strong&gt; later and after &lt;strong&gt;2091 files changed&lt;/strong&gt;, Coderloop infrastructure is eventually running on Rails 3. The full story of this migration deserves a blog post on its own and we will describe some opensource code that we have released. We are very proud of this big achievement and happy about…&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://andreapavoni.tumblr.com/post/2825072876</link><guid>http://andreapavoni.tumblr.com/post/2825072876</guid><pubDate>Wed, 19 Jan 2011 11:45:20 +0100</pubDate></item><item><title>Rails 3: An improved agnostic search model using Arel</title><description>&lt;p&gt;In the last post, I explained how to make conditional searches based on conditional params. I wrote a very simple search model that returns a real model with query done by Arel. I refactored the code to make i simpler to use:&lt;/p&gt;
&lt;script src="http://gist.github.com/465303.js?file=search.rb"&gt;&lt;/script&gt;&lt;p&gt;The constructor takes the model you want to search in, and an hash of params to use, they&amp;#8217;ll be the request params when used from controller. Note that if some param value is an empty string, it will be ignored: this lets the visitor to leave blank some fields in the search form and make it &lt;em&gt;conditional&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;To save typings, when specifying conditions, you can omit the value, because it&amp;#8217;s taken from the params hash. By the way, if you need some more control, you can specify another value. Finally, you can pass a block to make it easier to read. Here&amp;#8217;s a real usage example from a controller:&lt;/p&gt;
&lt;script src="http://gist.github.com/465303.js?file=realty_request_controller.rb"&gt;&lt;/script&gt;&lt;p&gt;When &lt;em&gt;Search#result&lt;/em&gt; is called a model instance is returned, it can still be ordered.&lt;/p&gt;
&lt;p&gt;According to &lt;a title="Arel README" href="http://github.com/rails/arel#readme"&gt;Arel README&lt;/a&gt;, there&amp;#8217;s no support for &lt;em&gt;OR&lt;/em&gt; conditions yet, I hope it will be included soon.&lt;/p&gt;
&lt;p&gt;What do you think about?&lt;/p&gt;</description><link>http://andreapavoni.tumblr.com/post/776670218</link><guid>http://andreapavoni.tumblr.com/post/776670218</guid><pubDate>Tue, 06 Jul 2010 14:34:46 +0200</pubDate><category>rails</category><category>arel</category><category>active-record</category></item><item><title>Rails3: using Arel to make conditional searches based on conditional params</title><description>&lt;p&gt;I needed simple searching on some models, and I didn&amp;#8217;t want to use any plugin for this task, just because I&amp;#8217;d like to try the new rails3 features, like ActiveRelation (Arel).&lt;/p&gt;
&lt;p&gt;I wrote a basic model called Search, I can re-use it for other models that need search features:&lt;/p&gt;
&lt;script src="http://gist.github.com/460215.js?file=search.rb"&gt;&lt;/script&gt;&lt;p&gt;Then I wrote a partial form with params, the following code is only an example, I have more fields:&lt;/p&gt;
&lt;script src="http://gist.github.com/460215.js?file=_search_form.html.erb"&gt;&lt;/script&gt;&lt;p&gt;Finally the controller action called &amp;#8216;search&amp;#8217;. As you can see, the difficult part was that you don&amp;#8217;t know which params are passed by the request, so you need to specify conditions only if they are present. Arel helped to resolve this problem:&lt;/p&gt;
&lt;script src="http://gist.github.com/460215.js?file=people_controller.rb"&gt;&lt;/script&gt;&lt;p&gt;Probably it&amp;#8217;s not the best solution, perhaps this could be optimized with some helper, but it works, and helps to figure out how Arel works.&lt;/p&gt;
&lt;p&gt;Webography:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a title="Greg Pollak - Rails 3 Beautiful Code" target="_blank" href="http://www.slideshare.net/GreggPollack/rails-3-beautiful-code-3219240"&gt;Greg Pollak - Rails 3 Beautiful Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Ryan Bates: Advanced Queries in Rails 3 (&lt;a title="Railscast: Advanced Queries in Rails 3" href="http://railscasts.com/episodes/215-advanced-queries-in-rails-3"&gt;watch&lt;/a&gt;, &lt;a title="ASCIIcast: Advanced Queries in Rails 3" href="http://asciicasts.com/episodes/215-advanced-queries-in-rails-3"&gt;read&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;</description><link>http://andreapavoni.tumblr.com/post/758178172</link><guid>http://andreapavoni.tumblr.com/post/758178172</guid><pubDate>Thu, 01 Jul 2010 18:59:00 +0200</pubDate><category>rails</category><category>ruby</category><category>arel</category></item><item><title>Basic user roles management (rails plugin)</title><description>&lt;p&gt;I&amp;#8217;m working on a very basic Rails plugin to simplify management of user roles. It doesn&amp;#8217;t cover authorizations (see &lt;a href="http://twitter.com/rbates"&gt;@rbates&lt;/a&gt;&amp;#8217;s &lt;a href="http://github.com/ryanb/cancan/"&gt;cancan&lt;/a&gt;), just role names and values (read it as levels).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
class User &amp;lt; ActiveRecord::Base
  acts_as_authentic
  has_roleplay(:admin =&amp;gt; 0, :teacher =&amp;gt; 1, :student =&amp;gt; 2)
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With this, you can now check wich roles are avaiable (eg: calling User.roles) or check if an user has the right role (eg: @current_user.is_admin?).&lt;/p&gt;
&lt;p&gt;The code will be avaiable very soon on github, I have to write tests ;)&lt;/p&gt;</description><link>http://andreapavoni.tumblr.com/post/398304114</link><guid>http://andreapavoni.tumblr.com/post/398304114</guid><pubDate>Fri, 19 Feb 2010 10:25:00 +0100</pubDate><category>ruby</category><category>rails</category><category>plugin</category></item><item><title> 
Granny twitters with a fax machine. Seems like something...</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/M09hESE0TBA?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;b&gt; &lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Granny twitters with a fax machine. Seems like something from &lt;a title="Onion TV"&gt;OnionTV&lt;/a&gt; but I like the bridge analogic-&gt;internet :-)&lt;/p&gt;</description><link>http://andreapavoni.tumblr.com/post/385219440</link><guid>http://andreapavoni.tumblr.com/post/385219440</guid><pubDate>Fri, 12 Feb 2010 09:17:47 +0100</pubDate><category>fun</category><category>twitter</category><category>technology</category></item></channel></rss>
