<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Rails on Notes</title>
    <link>https://www.simplicidade.org/tags/rails/index.xml</link>
    <description>Recent content in Rails on Notes</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>melo@simplicidade.org (Pedro Melo)</managingEditor>
    <webMaster>melo@simplicidade.org (Pedro Melo)</webMaster>
    <copyright>(c) 2016 Pedro Melo.</copyright>
    <atom:link href="/tags/rails/index.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsuhhubbub.superfeedr.com/"/>
    
    <item>
      <title>Week summary</title>
      <link>https://www.simplicidade.org/notes/2005/08/26/week-summary/</link>
      <pubDate>Fri, 26 Aug 2005 23:23:27 +0000</pubDate>
      <author>melo@simplicidade.org (Pedro Melo)</author>
      <guid>https://www.simplicidade.org/notes/2005/08/26/week-summary/</guid>
      <description>&lt;p&gt;No, I&amp;rsquo;m not going to talk more about Google Talk :).&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;m going to bed now, I&amp;rsquo;ve been up since 5am to do an upgrade to &lt;a href=&#34;http://messenger.sapo.pt/&#34;&gt;our&lt;/a&gt; &lt;a href=&#34;http://www.jabber.com/index.cgi?CONTENT_ID=125&#34;&gt;XMPP server platform&lt;/a&gt;. It went pretty well, but we still have some glitches with S2S. They should be solved real soon now.&lt;/p&gt;

&lt;p&gt;I wanted to talk you about the stack of perl books I have here, from &lt;a href=&#34;http://hop.perl.plover.com/&#34;&gt;Higher-Order Perl&lt;/a&gt; to &lt;a href=&#34;http://www.oreilly.com/catalog/perltestingadn/&#34;&gt;Perl Testing&lt;/a&gt; going through &lt;a href=&#34;http://www.oreilly.com/catalog/perlbp/&#34;&gt;Perl Best Practices&lt;/a&gt;, but it will have to wait until next week. I need to make them justice, they deserve it. It&amp;rsquo;s really nice to see very good books about Perl being published.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;ve also been reading the &lt;a href=&#34;http://www.rubycentral.com/book/&#34;&gt;Programming Ruby&lt;/a&gt; and the &lt;a href=&#34;http://www.pragmaticprogrammer.com/titles/rails/&#34;&gt;Rails book&lt;/a&gt;. Yeah, I know, some of you think it&amp;rsquo;s just a fad. Indulge me, ok? I&amp;rsquo;m still recommending anybody who wants to pick up a language, to try Ruby. I&amp;rsquo;ve collected some presentations about it from &lt;a href=&#34;http://conferences.oreillynet.com/os2005/&#34;&gt;OSCon&amp;rsquo;05&lt;/a&gt; that I&amp;rsquo;ll link next week.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;ve also finished my &lt;a href=&#34;http://www.edgewall.com/trac/&#34;&gt;Trac&lt;/a&gt; setup, and it is now totally automated to keep me using &lt;a href=&#34;http://www.darcs.net/&#34;&gt;darcs&lt;/a&gt; or, at work, CVS, and have all the niceties of the great Wiki, Tickets and Source browser integration. I&amp;rsquo;ll be moving my lost projects to it in the coming weeks.&lt;/p&gt;

&lt;p&gt;Finally, I updated my personal Jabber server to the latest &lt;a href=&#34;http://www.jivesoftware.org/messenger/&#34;&gt;Jive Messenger&lt;/a&gt;. I had been using &lt;a href=&#34;http://ejabberd.jabber.ru/&#34;&gt;ejabberd&lt;/a&gt; for some time now, but I wanted something that I could just install, run a script and be done with it. I can only say that I was able to do just that with Jive Messenger, I think it took me 15 to 20 minutes to have a fully featured XMPP server. The &lt;a href=&#34;http://www.jivesoftware.org/messenger/screenshots.jsp&#34;&gt;newest version&lt;/a&gt;, 2.2, it&amp;rsquo;s the first one I can use since it&amp;rsquo;s the first to have S2S. They don&amp;rsquo;t have TLS, but it&amp;rsquo;s not important to me right now: my client of choice, &lt;a href=&#34;http://psi-im.org/&#34;&gt;Psi&lt;/a&gt; (who &lt;a href=&#34;http://psi.affinix.com/forums/index.php?act=ST&amp;amp;f=5&amp;amp;t=2984&#34;&gt;incidentally&lt;/a&gt; also had a new release today, check the &lt;a href=&#34;http://psi-im.org/wiki/Main_Page&#34;&gt;new Psi wiki&lt;/a&gt;, btw), does not support TLS for now. But if TLS is important to you, don&amp;rsquo;t despair: adding TLS to Jive Messenger is a &lt;a href=&#34;http://code.google.com/summerofcode.html&#34;&gt;Google Summer of Code&lt;/a&gt; project.&lt;/p&gt;

&lt;p&gt;Also, &lt;a href=&#34;http://www.sixapart.com/movabletype/&#34;&gt;Moveable Type 3.2 is out&lt;/a&gt;, &lt;a href=&#34;http://www.sixapart.com/movabletype/news/2005/06/movable_type_32_is_comin.html&#34;&gt;looking&lt;/a&gt; &lt;a href=&#34;http://www.sixapart.com/movabletype/features&#34;&gt;good&lt;/a&gt;. For those of us who still like to run and waste our time tinkering with our blog software, it&amp;rsquo;s seems a worthy upgrade. I was very impressed with &lt;a href=&#34;http://www.sixapart.com/pronet/weblog/2005/07/easiest_upgrade.html&#34;&gt;the upgrade demo&lt;/a&gt;. I was thinking on upgrading my software, lot&amp;rsquo;s of bugs, and more trackback spam than I can read in a lifetime, and I was shopping around for software. MT 3.2 seems to be crawling back to the top of my list of choices, followed by &lt;a href=&#34;http://typo.leetsoft.com/trac&#34;&gt;typo&lt;/a&gt; and &lt;a href=&#34;http://wordpress.org/&#34;&gt;wordpress&lt;/a&gt;, in that order.&lt;/p&gt;

&lt;p&gt;With all the Google Talk, I&amp;rsquo;ve been a bit away from Apple news. The &lt;a href=&#34;http://www.intel.com/idf/us/fall2005/index.htm?iid=HPAGE+up_feat_05ww35&amp;amp;&#34;&gt;IDF conference&lt;/a&gt; this week had a lot of cool stuff (my favorite, &lt;a href=&#34;http://anandtech.com/tradeshows/showdoc.aspx?i=2511&#34;&gt;the end of the north bridge on Intel chipsets&lt;/a&gt;, you should check &lt;a href=&#34;http://anandtech.com/tradeshows/default.aspx&#34;&gt;AnandTech site&lt;/a&gt; for all the goodies. I didn&amp;rsquo;t have the time to read to much into it, regarding Apple future hardware offers, but it looks promising.&lt;/p&gt;

&lt;p&gt;Yet, my interest regarding Apple news will grow in the coming weeks. The &lt;a href=&#34;http://www.apple-expo.com/&#34;&gt;Apple Paris Expo&lt;/a&gt; is coming up in late September, and I would like to see a last rev of G4 &lt;a href=&#34;http://www.apple.com/powerbook/&#34;&gt;Powerbooks&lt;/a&gt; coming out of Mr. Jobs keynote. I would be a happy camper to see a dual-core G4 17&amp;rdquo; or bigger Powerbook&amp;hellip; But I&amp;rsquo;ll try to keep my expectations low.&lt;/p&gt;

&lt;p&gt;All in all, a fun week. My only regret is that my coding time is getting to be a lot less than it usually was. And now that it was getting to be fun again. I&amp;rsquo;ve been making an effort to do more developer testing, and so far I&amp;rsquo;m loving it. It can be hard sometimes, with the pressure of every day, but it&amp;rsquo;s a great stress reliever for me. I should join &lt;a href=&#34;http://qa.perl.org/phalanx/&#34;&gt;Phalanx&lt;/a&gt; some day, I really should.&lt;/p&gt;

&lt;p&gt;Have a nice weekend.
&lt;!-- technorati tags start --&gt;&lt;p style=&#34;text-align:right;font-size:10px;&#34;&gt;Technorati Tags: &lt;a href=&#34;http://technorati.com/tag/apple&#34; rel=&#34;tag&#34;&gt;apple&lt;/a&gt;, &lt;a href=&#34;http://technorati.com/tag/darcs&#34; rel=&#34;tag&#34;&gt;darcs&lt;/a&gt;, &lt;a href=&#34;http://technorati.com/tag/jabber&#34; rel=&#34;tag&#34;&gt;jabber&lt;/a&gt;, &lt;a href=&#34;http://technorati.com/tag/trac&#34; rel=&#34;tag&#34;&gt;trac&lt;/a&gt;, &lt;a href=&#34;http://technorati.com/tag/xmpp&#34; rel=&#34;tag&#34;&gt;xmpp&lt;/a&gt;&lt;/p&gt;&lt;!-- technorati tags end --&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Ruby on Rails, and Catalyst</title>
      <link>https://www.simplicidade.org/notes/2005/06/04/ruby-on-rails-and-catalyst/</link>
      <pubDate>Sat, 04 Jun 2005 12:55:43 +0000</pubDate>
      <author>melo@simplicidade.org (Pedro Melo)</author>
      <guid>https://www.simplicidade.org/notes/2005/06/04/ruby-on-rails-and-catalyst/</guid>
      <description>&lt;p&gt;So, after having learned a bit about &lt;a href=&#34;http://www.ruby-lang.org/&#34;&gt;Ruby&lt;/a&gt;, the next logical step for me was to try &lt;a href=&#34;http://www.rubyonrails.org/&#34;&gt;Ruby-On-Rails&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A bit of background: before going to work at &lt;a href=&#34;http://www.sapo.pt/&#34;&gt;Sapo&lt;/a&gt; in the XMPP Messenger product, I was a lead-developer at &lt;a href=&#34;http://www.novis.pt/&#34;&gt;Novis&lt;/a&gt;. My main task there, was to build websites and provisioning systems, and the glue that ties billing systems with technical databases. We used a framework that was developed internally since &amp;lsquo;99, and in it&amp;rsquo;s latest generation was called Apache::WAF. It was a MVC-style framework, with a strict separation between code and layout. The View was Template Toolkit, but it was extensible to other technologies (we used Mason a lot also). The Model where our own provisioning system libraries and other stuff. Apache::WAF allowed us to build the Controller very quickly. Also, it was pretty fast, using mod_perl.&lt;/p&gt;

&lt;p&gt;So using MVC-style frameworks in web development is nothing new to me.&lt;/p&gt;

&lt;p&gt;Except that Ruby-On-Rails is much more than that, and in a extremely clean package. You can get up-to-speed in no time, thanks in part to the generation of code that is the base of RoR, and also to the Screencasts available at the &lt;a href=&#34;http://www.rubyonrails.org/&#34;&gt;Ruby-On-Rails website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Also, having a clean and powerful language behind it, it sure helps.&lt;/p&gt;

&lt;p&gt;It&amp;rsquo;s not perfect. The part of mapping URLs to controllers could be better. RoR uses the same setup that Apache::WAF uses: you register URL namespaces on a special config file and associate them with controllers. The main advantage I see with this approach is that you can look at this single config file and know all the URLs of your app, so clashes are less likely.&lt;/p&gt;

&lt;p&gt;The Model part of RoR is just excellent. As far as I can tell, there is no Perl equivalent to ActiveRecord. Yes, yes, I know about Class::DBI and Alzabo, and the others. But those solutions solve the CRUD problem: creating, retrieving, updating and deleting one object at a time. They all have solution for forging relations between tables and objects. But ActiveRecord does all that and more. It&amp;rsquo;s the first framework (and I really expect and would love to see some perl guru to jump on me on this one and say &amp;ldquo;Have you looked at X on CPAN?&amp;rdquo;&amp;hellip;) I&amp;rsquo;ve seen that solves the 1+100 queries problem efficiently.&lt;/p&gt;

&lt;p&gt;The 1+100 queries problem is simple to understand: suppose you have a Books table and a Authors table (for simplicity, a book can only have one author), and you want to list all the books with the respective authors.&lt;/p&gt;

&lt;p&gt;With a basic CRUD framework, you do a &lt;code&gt;Books-&amp;gt;find_all&lt;/code&gt; or &lt;code&gt;Books-&amp;gt;search&lt;/code&gt; to get all the books and for each one, you do something like &lt;code&gt;$book-&amp;gt;author-&amp;gt;name&lt;/code&gt; to get the author name. If the first query for books returns 100 books, you&amp;rsquo;ll then do 100 queries for authors. Yes, yes, you could cache ID-&amp;gt;name of authors, but that really is not the point. The point is that something that should be done with a simple join at the database level with a single query, is now being done with multiple queries (and if you write to me saying that &amp;ldquo;Yeah, but my MySQL is fast enough you wont even notice&amp;rdquo;, I&amp;rsquo;ll warn you right now that I&amp;rsquo;ll verbally abuse you. Real world is a lot different).&lt;/p&gt;

&lt;p&gt;ActiveRecord is able to solve this. You can say that &amp;ldquo;Please give me all the books, and also their respective authors&amp;rdquo; and with a single query to the database, you&amp;rsquo;ll get a list of Book object with the author method returning a pre-created object. You can even specify which fields you need from author.&lt;/p&gt;

&lt;p&gt;It&amp;rsquo;s very very good! The Model in Ruby-On-Rails is for me the part that makes the most difference to the other MVCs I&amp;rsquo;ve used in the past.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Of course the Perl community is not standing still. For quite some time, I knew about &lt;a href=&#34;http://maypole.perl.org/&#34;&gt;Maypole&lt;/a&gt;. I&amp;rsquo;ve tried to use in the past and it was a painful experience. The setup was not straight forward as I would expect (in Perl, simple things should be easy). Maybe I&amp;rsquo;m dense, but it took me some time to get some type of application going.&lt;/p&gt;

&lt;p&gt;Recently, &lt;a href=&#34;http://catalyst.perl.org/&#34;&gt;Catalyst&lt;/a&gt; emerged as the new kid on the Perl block. I&amp;rsquo;ve used it also in some early versions, and I decided to try it again last week.&lt;/p&gt;

&lt;p&gt;It&amp;rsquo;s very very good. It borrows a lot of ideas from RoR, like the code generation features. The View can be Template Toolkit (like Apache::WAF), but also Mason, HTML::Template and others.&lt;/p&gt;

&lt;p&gt;The Controller is nice. They use method attributes to specify the URL that your class listens to. For example, if your App is Library, and you have a Controller Library::C::Author, and inside that you write:&lt;/p&gt;

&lt;pre&gt;
sub add : Local { code }
sub view : Path(&#39;/my/path&#39;) { code }
sub show : Regex(&#39;^show_author/(\d+)$&#39;) { code }
&lt;/pre&gt;

&lt;p&gt;You&amp;rsquo;ll get the following URLs: &lt;code&gt;/author/add&lt;/code&gt; (it uses the class name after Library::C as a URL path), &lt;code&gt;/my/path&lt;/code&gt;, and &lt;code&gt;/show_author/42&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Each URL will be dispatched to the correct method.&lt;/p&gt;

&lt;p&gt;It&amp;rsquo;s very nice, and in contrast with RoR, you see the URLs in the controller. It can be dangerous because two different controllers can claim the same Global URL, but overall I prefer this approach. It has all the power of RoR (the &lt;code&gt;add&lt;/code&gt; method above is like RoR), and much more. Of course, I can be totally wrong, I&amp;rsquo;m not an expert with either of these two frameworks, but as far as I can tell, this is the way things are.&lt;/p&gt;

&lt;p&gt;But the feature I like the most in Catalyst is the simplicity. It&amp;rsquo;s just dead simple to use! If you know your Perl, you can be up and running in 5 minutes or less. Comparing with Apache::WAF, I can see that we did a lot of stuff there that it&amp;rsquo;s not needed.&lt;/p&gt;

&lt;p&gt;Catalyst is a perfect example of the KISS principle (and I&amp;rsquo;m amazed I could not find a Wikipedia page about the KISS principle to link to).&lt;/p&gt;

&lt;p&gt;The Model part can be anything: Class::DBI, Net::LDAP, you name it. But as I said above, I don&amp;rsquo;t know a Model as good as ActiveRecord in Perl, so for now, the Model part is inferior in Perl-land.&lt;/p&gt;

&lt;p&gt;To see more of Catalyst in action, check out the &lt;a href=&#34;http://www.perl.com/pub/a/2005/06/02/catalyst.html&#34;&gt;article&lt;/a&gt; at &lt;a href=&#34;http://www.perl.com/&#34;&gt;Perl.com&lt;/a&gt;.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;AJAX as been in the news and both of these two frameworks support it very well. They both use the &lt;a href=&#34;http://prototype.conio.net/&#34;&gt;Prototype&lt;/a&gt; JS library. This library was developed with RoR on it&amp;rsquo;s mind, and it shows. Although its the same one, I saw some shortcuts to do cool and useful stuff in RoR that don&amp;rsquo;t seem to be present in Catalyst (my favorite example of this is the &lt;a href=&#34;http://sean.treadway.info/demo/upload&#34;&gt;upload ajax widget&lt;/a&gt;). But that is a small issue. It&amp;rsquo;s easy to see how it works in Rails and port it to Catalyst.&lt;/p&gt;

&lt;p&gt;Although I&amp;rsquo;ve been using Prototype, there is a non-free alternative that you should be aware of. The nice folks at &lt;a href=&#34;http://www.backbase.com/&#34;&gt;Backbase&lt;/a&gt; have a extremely powerful JS framework to build Rich Internet Applications. You can download the Community Edition (it was made available yesterday) and try it out, and even use it for noncommercial uses. It&amp;rsquo;s the best JS framework I&amp;rsquo;ve seen. My single problem with it: it does not, at this time, supports Safari. They are still working on it.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;So to summarize, we have some great tools to build webapps. Ruby on rails is getting a lot of press, but fear not, my fellow camel-loving friends, Perl is in good shape with Catalyst.&lt;/p&gt;

&lt;p&gt;Ruby on rails seems to have an edge on AJAX stuff, but I don&amp;rsquo;t think it will last.&lt;/p&gt;

&lt;p&gt;I still think that Ruby is a better, cleaner language than Perl5, and that might make a difference for some of you, but I&amp;rsquo;m an old perl guy, so I&amp;rsquo;ll be using a lot of Catalyst in the months to come.&lt;/p&gt;

&lt;p&gt;Now, I need to find a ActiveRecord-type of framework for Perl.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Got my ticket to Reboot7</title>
      <link>https://www.simplicidade.org/notes/2005/06/04/got-my-ticket-to-reboot7/</link>
      <pubDate>Sat, 04 Jun 2005 02:03:51 +0000</pubDate>
      <author>melo@simplicidade.org (Pedro Melo)</author>
      <guid>https://www.simplicidade.org/notes/2005/06/04/got-my-ticket-to-reboot7/</guid>
      <description>&lt;p&gt;Got my ticket to &lt;a href=&#34;http://reboot.dk/reboot7&#34;&gt;Reboot7&lt;/a&gt; today.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;m going with &lt;a href=&#34;http://blog.delaranja.com/&#34;&gt;André&lt;/a&gt; and &lt;a href=&#34;http://www.patriciaepedro.com/pedro/blog/&#34;&gt;Pedro&lt;/a&gt; next week.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;m assuming that we&amp;rsquo;ll have some network connectivity, so you can expect some notes about each conference I attend.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Learning Ruby</title>
      <link>https://www.simplicidade.org/notes/2005/04/19/learning-ruby/</link>
      <pubDate>Tue, 19 Apr 2005 01:01:14 +0000</pubDate>
      <author>melo@simplicidade.org (Pedro Melo)</author>
      <guid>https://www.simplicidade.org/notes/2005/04/19/learning-ruby/</guid>
      <description>&lt;p&gt;I needed something new to do, to learn, and I decided to learn a new language. That was 2 months ago more or less.&lt;/p&gt;

&lt;p&gt;I though about learning OCaml or Haskell but I don&amp;rsquo;t have the correct mental model to learn something like that just now. So I went with something easy, given my background.&lt;/p&gt;

&lt;p&gt;I picked up Programming Ruby a month or so ago, and I just finished my first reading of it. I must say that I was very impressed. The language is very clean, very simple and seems extremely powerful.&lt;/p&gt;

&lt;p&gt;I was browsing some Ruby sites and I went to &lt;a href=&#34;http://wiki.rubyonrails.com/rails/show/HomePage&#34;&gt;Ruby on Rails website&lt;/a&gt;. I had heard about it from several places, the latest on was &lt;a href=&#34;http://tadalist.com/&#34;&gt;Tada lists&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let me put it this way: if you want to &lt;a href=&#34;http://wiki.rubyonrails.com/rails/show/RailsAcademy&#34;&gt;get hooked&lt;/a&gt;, download &lt;a href=&#34;http://rubyonrails.cachefly.net/updated_rails_tutorial.mov&#34;&gt;this 47Mb video&lt;/a&gt; and watch the full 30 minutes of it. It&amp;rsquo;s something short of a revelation.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;ve been a perl programmer the last 13 or 14 years, but this small video made a small place for Ruby in my toolbox. will see how this small place grows in the next months. Now, I must find a small project to try Ruby on Rails&amp;hellip;&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>