A Donut's Blog

To content | To menu | To search

Tag - Framework

Entries feed - Comments feed

Friday, January 14 2011

phpBB donates €5000 to Sensio Labs

I woke up this morning and checked Twitter.

skoop wait. what? *gasp* *faints* #phpBB just donated a whopping 5000 euro towards the #Symfony2 donation drive! These guys ROCK!

(link to tweet)

I'm glad Stefan and Fabien posted about this on Twitter and on their blog which describes the fundraiser (see the comments).

This isn't the first donation that phpBB has made to such an organization, but it may be the first one you've heard of - only because this one was publicized by the recipients of the donation. phpBB has traditionally reciprocated well to the organizations which provide services to it (Symfony, OSUOSL, and others).

Monday, October 25 2010

Rails Routes and REST

There was a discussion about how this worked earlier today, and I thought I would take the liberty to explain.

Rails respects REST. That is, distinctions are made between GET, POST, HEAD, PUT, and DELETE requests. More Details.

Rails maintains a routing table to keep track of what's what. This is accessible with rake routes. The following output is only partial.

       accounts_login GET    /accounts/login(.:format)        {:controller=>"accounts", :action=>"login"}
     accounts_private GET    /accounts/private(.:format)      {:controller=>"accounts", :action=>"private"}
accounts_authenticate        /accounts/authenticate(.:format) {:controller=>"accounts", :action=>"authenticate"}
      accounts_logout        /accounts/logout(.:format)       {:controller=>"accounts", :action=>"logout"}
         competitions GET    /competitions(.:format)          {:action=>"index", :controller=>"competitions"}
         competitions POST   /competitions(.:format)          {:action=>"create", :controller=>"competitions"}
      new_competition GET    /competitions/new(.:format)      {:action=>"new", :controller=>"competitions"}
     edit_competition GET    /competitions/:id/edit(.:format) {:action=>"edit", :controller=>"competitions"}
          competition GET    /competitions/:id(.:format)      {:action=>"show", :controller=>"competitions"}
          competition PUT    /competitions/:id(.:format)      {:action=>"update", :controller=>"competitions"}
          competition DELETE /competitions/:id(.:format)      {:action=>"destroy", :controller=>"competitions"}
             accounts GET    /accounts(.:format)              {:action=>"index", :controller=>"accounts"}
             accounts POST   /accounts(.:format)              {:action=>"create", :controller=>"accounts"}
          new_account GET    /accounts/new(.:format)          {:action=>"new", :controller=>"accounts"}
         edit_account GET    /accounts/:id/edit(.:format)     {:action=>"edit", :controller=>"accounts"}
              account GET    /accounts/:id(.:format)          {:action=>"show", :controller=>"accounts"}
              account PUT    /accounts/:id(.:format)          {:action=>"update", :controller=>"accounts"}
              account DELETE /accounts/:id(.:format)          {:action=>"destroy ", :controller=>"accounts"}

When Rails sees an HTTP GET request to /accounts/new, it will run the "new" method in the "accounts" controller. If it sees an HTTP POST request to /competitions/, it runs the "create" method in the "competitions" controller and so forth.

This is how the HTML forms get connected up. The form has a submit action of /competitions. I extracted that tidbit from this line:

<form accept-charset="UTF-8" action="/competitions" class="new_competition" id="new_competition" method="post">

When the "Create Competition" button is pressed, the web browser makes an HTTP POST request (as defined in the form's method parameter) to /competitions. Rails looks at that and compares it to its routing table.

Hope that's a reasonable explanation.

Friday, October 1 2010

Rails: Where's the Good Docs?

I've been using PHP for a really long time. The main point that attracted me to PHP was the manual, which is by all accounts excellent.

So I began trying to learn Rails in the last few weeks. While there are a number of decent, or even good, tutorials on various topics, the actual documentation seems to be lacking. I've been using http://api.rubyonrails.org/, but it seems to be very deficient. Not searchable and hard to navigate. Oh, and a large number of methods have no documentation at all. For example, the session has six methods, only one of which has anything more than an argument list.

Is there something more I'm missing? Because the time wasted searching all over God's Green Internet for answers to questions like "what does ynaqdh mean?" is getting to me.

Monday, September 20 2010

Documenting an old Rails version

I was told that I needed to install Rails2 to work on a project. (Note: Rails3 was released some time ago.)

The documentation was all updated for Rails3. This is good, if you're wanting to use Rails3. It turns out this is very bad if you want to use Rails2.

I started with the getting started tutorial. The first problem I encountered is in the "assumptions" section. I installed Ruby 1.9.2. I then went to install RubyGems. It refused to install. So I tweeted. I actually got help (something I wasn't explicitly looking for) from @luislavena, who actually works on making Ruby more Windows friendly. One of the blog posts in his wiki took about 5 words to note that RubyGems is bundled with Ruby 1.9.x.

Well, problem #1 solved. I skipped the second point of the getting started tutorial purely for its irrelevance to the task at hand, and its length. I ran gem install rails -v 2.8.7, which worked fine. The next step in the tutorial said rails new blog would create a project called "blog". Wrong. It created a project called "new." Turns out this syntax changed between rails2 and rails3.

The next rails command was bundle install. This gave an executable not found error. "bundle" is a separate gem, and was not included by default. This took some Bing-fu to figure out.

And finally, I hit step four, to see if it actually worked. It didn't. rails server did not exist in rails2. The rails2 equivalent was ruby script/server.

At this point, I can only pray that the actual RoR code is compatible across Rails versions...

Friday, August 20 2010

Frameworks and Open Source

Stefan Koopmanschap made a very interesting point in his talk this morning at Libertyvasion.

None of the significant open source PHP projects (WordPress, Joomla, Drupal, phpBB, MyBB, OSCommerce, OpenX, blah, blah, blah) are written based on any of the open-source frameworks which are available.

I'd like to have a discussion on why that is.

I'll opine that PHP frameworks are a relatively new phenomenon. WordPress, Joomla, Drupal, phpBB and MyBB are all using really old codebases (I'm not familiar with the code bases for OSCommerce or OpenX). Symfony 1.0 was rolled in 2007, and none of those softwares have received a complete rewrite since then.

But your thoughts?