Episode IV: A New Pope

This post is by Tim Pope from Official Hashrocket Blog

Click here to view on the original site: Original Post

I’ve moved my blog to Jekyll. I think this is the post where I’m supposed to apologize for falling off the blog wagon and promise to post more in the future, though truth be told I have few regrets and make no promises. My aged Drupal install had gotten to the point where I felt actively discouraged from posting. Now that I’ve rectified that, I’ve at least enabled myself to post in the future if I have any flashes of inspiration. Still, I promise nothing. I only migrated the handful of posts that seemed less than completely obsolete.

My migration process produced two noteworthy artifacts: Vim syntax highlighting for Liquid and the same for Markdown. There are existing implementations of both of these, but they had limitations I could not accept (most notably, I couldn’t combine them). The Liquid set has some Jekyll specific goodies like YAML front matter highlighting and support for Pygments highlight blocks. You need to explicitly specify which types of highlight blocks you want highlighted and map between the Pygments type and Vim type in your vimrc:

let g:liquid_highlight_types=["html","erb=eruby","html+erb=eruby.html"]

Canable: The Flesh Eating Permission System

This post is by John Nunemaker from RailsTips by John Nunemaker

Click here to view on the original site: Original Post

A while back I wrote about how to add simple permissions to your apps. Since then, I have worked on a few applications (Harmony among them) where I have taken that concept and expanded it. Yesterday, I decided that I had repeated myself enough times (3) and that I should abstract the shared functionality of those apps into a gem. Thus, Canable, the flesh eating permission system, was born.


Canable does not actually implement any permissions for you (or actually eat flesh). Instead, it provides you with all the helpers and then (gasp) you have to do the work. The idea centers around running all permissions through current_user. Anytime you check if a user can do something you use a can method:



Instead of having a big case statement in those can methods for each different type of object, I use the strategy pattern to just ask the object if the user has permission to do the action. This is done by having a matching “able” method to the “can” method, thus canable.

class Item
  def updatable_by?(user)
    creator == user

The above code, for example, makes it so that only the creator of an item can update it. Obviously, you can get more in depth from there. By default, I add the following can and able methods:

:view => :viewable
:create => :creatable
:update => :updatable
:destroy => :destroyable

Custom Actions

If you need permissions for actions other than the defaults, you can add your own quite easily:

Canable.add(:publish, :publishable)

The readme over on Github has far more details, but I figured I would at least cover it here a bit. It might seem a bit weird at first, but once you start rolling with it, it makes for a pretty easy to implement and understand permission system.

The really funny part is that it is only like 80 lines of code, as most of the methods are dynamically generated. I am perfectly fine if I am the only one who uses this and finds it helpful, but you never know, so feel free to install it as a gem or fork it on github.

Note: No permissions were harmed in the making of this gem.

What’s New in Edge Rails: Skinny on Scopes

This post is by ryan from Ryan's Scraps - Blog

Click here to view on the original site: Original Post

I go into a detailed explanation of using ActiveRecord scopes in Rails 3 over on EdgeRails.info.

I won’t be cross-posting for too much long, so update your feed to the new EdgeRails feed to keep abreast of the latest and greatest!

Using acts_as_archive instead of soft delete

This post is by Luke Francl from Rail Spikes - Home

Click here to view on the original site: Original Post

        For the application I am working on right now, the ability to restore content that has been deleted is one of the requirements. A lot of people would just go ahead and add <a href="http://github.com/technoweenie/acts_as_paranoid"><code>acts_as_paranoid</code></a> or <a href="http://github.com/semanticart/is_paranoid"><code>is_paranoid</code></a> and be done with it, but I've had trouble with that approach before.

I’ve been reading a lot about the trouble with “soft deletes” (flagging a record as deleted instead of deleting it). Using a plugin that monkey patches ActiveRecord can go a long way towards fixing thesee problems, but it’s a leaky abstraction and will bite you in the ass in unexpected ways. For example, all your uniqueness validations (and indexes) become much more complicated.

That’s why Jeffrey Chupp decided to kill is_paranoid and Rick Olson doesn’t use acts_as_paranoid any more.

There are other problems too. If you delete a lot of records, and you keep them in the same table, your table

Post model

Continue reading “Using acts_as_archive instead of soft delete”

Using acts_as_archive instead of soft delete

This post is by Luke Francl from Rail Spikes - Home

Click here to view on the original site: Original Post

For the application I am working on right now, the ability to restore content that has been deleted is one of the requirements. A lot of people would just go ahead and add acts_as_paranoid or is_paranoid and be done with it, but I’ve had trouble with that approach before.

I’ve been reading a lot about the trouble with “soft deletes” (flagging a record as deleted instead of deleting it). Using a plugin that monkey patches ActiveRecord can go a long way towards fixing thesee problems, but it’s a leaky abstraction and will bite you in the ass in unexpected ways. For example, all your uniqueness validations (and indexes) become much more complicated.

That’s why Jeffrey Chupp decided to kill is_paranoid and Rick Olson doesn’t use acts_as_paranoid any more.

There are other problems too. If you delete a lot of records, and you keep them in the same table, your table can get quite large, and all your queries slow down. At this point you have to use partitioning or partial indexes to get acceptable performance.

Alternatives to soft delete

In my reading, I found two alternatives to soft delete to be compelling.

The first was the suggestion to properly model your domain. Why do you want to delete a record? What does that mean? Udi Dahan puts it this way:

Orders aren’t deleted – they’re cancelled. There may also be fees incurred if the order is canceled too late.

Employees aren’t deleted – they’re fired (or possibly retired). A compensation package often needs to be handled.

Jobs aren’t deleted – they’re filled (or their requisition is revoked).

Keeping that in mind, what if the task at hand really is to delete the record? The other idea that I liked was to archive the records in another table.

The first Rails plugin I came across that implemented this was acts_as_soft_deletable which besides being misnamed doesn’t appear to be actively maintained. The author even disavows the plugin somewhat for Rails 2.3:

Before using this with a new Rails 2.3 app, you may want to consider using the new default_scope feature (or named_scopes) with a deleted_at flag.

Then I found acts_as_archive which is more recently maintained and used in production for a major Rails website.

There was only one problem — acts_as_archive didn’t support PostgreSQL. Fortunately, that was easy enough to fix.

Restoring deleted records with acts_as_archive

acts_as_archive has the ability to restore a deleted record, but only that record, not associated records.

I was troubled by this at first, but after thinking about it I came to the conclusion that restoring a network of objects is an application-dependant problem. Here’s one way to achieve it.

Imagine you have a model like this, with Posts having many Comments and Votes.

Post model

A Post can be deleted, and when it is, it should take the Comments and Votes with it:

class Post

  has_many :votes, :dependent => :destroy
  has_many :comments, :dependent => :destroy

(Assume Comment and Vote also have acts_as_archive.)

Now, I can restore a Post with its associated Votes and Comments like this:

def self.restore(id)
  transaction do
    Post.restore_all(["id = ?", id])
    post = Post.find(id)

    Vote.restore_all(Vote::Archive.all(:conditions => ["post_id = ?", id]).map(&:id))
    Comment.restore_all(Comment::Archive.all(:conditions => ["post_id = ?", id]).map(&:id))

In my real code, I’ve broken apart the two pieces of this into a class method restore and an instance method post_restore which the freshly restored object uses to find its associated records and restore them. post_restore also takes care of post-restore tasks like putting the object back in the Solr index.

This all works great. But now let’s say Comments can be deleted individually, and we want to restore them.

Here the logic is a little different, because a Comment can’t be restored unless its parent Post still exists (unless it’s being restored by the Post, as above).

I take care of this logic in the administrative controller, by only showing child objects that it’s valid to restore, and my foreign key constraints prevent anyone from getting around that.

I really wanted to delete that!

Sometimes you don’t want to archive a deleted object. For example, in the application I’m working on, votes are canceled by re-voting. I don’t want to save those votes — there’s no point, and it can even cause problems with restoring. Imagine having several archived votes from a user for a Post, and then deleting and restoring that Post. The restoration will try to bring back all the votes. Again, I catch this with a uniqueness constraint, but I don’t want it to happen in the first place.

Fortunately acts_as_archive has me covered.

To destroy a record without archiving it, you can use destroy!. Likewise for deleting, there is delete_all!.

Guillaume Petit Winner RPCFN #6

This post is by Satish Talim from RubyLearning Blog

Click here to view on the original site: Original Post

In this brief interview, Satish Talim of RubyLearning talks to Guillaume Petit of France, winner of the sixth Ruby Programming Challenge For Newbies.

Guillaume Petit

Satish>> Welcome Guillaume and thanks for taking out time to share your thoughts. For the benefit of the readers, could you tell us something about your self?

Guillaume>> Thanks Satish for the opportunity. My name is Guillaume Petit a 26 year old nomad who sets off on a journey in the world of programming languages and has not come back yet! Aside from this, my main hobbies are reading manga, watching movies ( I am especially looking for great quotes ) or just stumbling on the Internet!

Satish>> How did you get involved with Ruby programming?

Guillaume>> It started about two years back when I discovered Ruby on Rails. I was more curious about this framework than Ruby itself at first (which I did not know), but I quickly got hooked by the language. Since then, I have been using Ruby for daily scripts here and there and continue to play with it.

Satish>> Could you name three features of Ruby that you like the most, as compared to other languages? Why?

Guillaume>> Ok, the first feature I really enjoy are blocks. Blocks offer a very powerful, yet easy way to deal with loops, iterations and nameless functions. It’s almost natural. What is really interesting is that when I started using blocks, I did not really understand the mechanism beneath, but yet, I was able to make good use of them.

Then I would go for the elegance and agility of the syntax. It’s an important point for me, a language needs to be pleasant when it comes to writing code, and in Ruby, it’s just a breeze.

The last point is more a way of doing things that a plain feature, I think. I am talking about testing. Ruby makes it really easy to test your code, and the Ruby community has largely adopted this practice. Using Ruby really made me aware of the importance of using tests, which I never did before with other languages that I used; so let’s call it a feature for today.

Satish>> How was experience of taking part in the Ruby Programming Challenge For Newbies (RPCFN)?

Guillaume>> It was fun. I like those challenges because they make you think and use the language in a way you may not be familiar with. While resolving the problem, you learn more about the language. It’s a very efficient way to progress.

Satish>> How is the Ruby and Rails scenario in your country France?

Guillaume>> It’s not quite as popular as I would like it to be, but it’s making its way in.

Satish>> What are your future plans?

Guillaume>> You really hit the spot with this question since I am actually looking for the answer myself. I guess I will have to win the next challenge, this will give me some more time to answer! ;-)

More seriously, I am actually working on a Rails application to create and manage web surveys, and maybe I will do an iPhone version of it!

See you on the next challenge !

Thank you Guillaume. In case you have any queries and/or questions, kindly post your questions here (as comments to this blog post) and Guillaume would be glad to answer.

Technorati Tags: , , , , ,

The state of Rails plugins

This post is by Max Murphy from elc technologies - Blog : Ruby on Rails, iPhone, Flash, Agile, Interactive Design

Click here to view on the original site: Original Post

Plugins are great, they help you dry up your code, add features, etc. quickly and easily. But how do you know if a plugin is going to be good, or if it’s outdated completely…..
I usually check the following sites to find out:
http://railsplugins.org/ and http://www.ruby-toolbox.com/
The latter is mostly an overview of gems categorized by what they […]

Using will_paginate in sinatra

This post is by Max Murphy from elc technologies - Blog : Ruby on Rails, iPhone, Flash, Agile, Interactive Design

Click here to view on the original site: Original Post

Want some sweet pagination on your sinatra app? I know it’s a loaded question with sinatra’s methodology of keeping things slim, but here goes.
There is a framework agnostic branch of mislav-will_paginate on github. What I did was pull that into vendor/gems and added the following code to make it work.
$LOAD_PATH.unshift File.dirname(__FILE__) + ‘/vendor/gems/will_paginate/lib’ # using […]


This post is by Ben from BenCurtis.com

Click here to view on the original site: Original Post

Well, I’ve put this off for as long as I could, but I think now is the time to make my first hire. I’m busy enough with client work and with my own projects that I need some help. So, if you or someone you know is looking for a part-time Rails job in Kirkland, WA, apply now! 🙂

Ruby’s Implementation Does Not Define its Semantics

This post is by wycats from Katz Got Your Tongue?

Click here to view on the original site: Original Post

When I was first getting started with Ruby, I heard a lot of talk about blocks, and how you could “cast” them to Procs by using the & operator when calling methods. Last week, in comments about my last post (Ruby is NOT a Callable Oriented Language (It’s Object Oriented)), I heard that claim again.

To be honest, I never really thought that much about it, and the idea of “casting” a block to a Proc never took hold in my mental model, but when discussing my post with a number of people, I realized that a lot of people have this concept in their mental model of Ruby.

It is not part of Ruby’s semantics.

In some cases, Ruby’s internal implementation performs optimizations by eliminating the creation of objects until you specifically ask for them. Those optimizations are completely invisible, and again, not part of Ruby’s semantics.

Let’s look at a few examples.

Blocks vs. Procs

Consider the following scenarios:

def foo
def bar(&block)
  puts block.object_id
def baz(&block)
  puts block.object_id
foo { puts "HELLO" } #=> "HELLO"
bar { puts "HELLO" } #=> "2148083200\n2148083200\nHELLO"

Here, I have three methods using blocks in different ways. In the first method (foo), I don’t specify the block at all, yielding to the implicit block. In the second case, I specify a block parameter, print its object_id, and then send it on to the baz method. In the third case, I specify the block, print out its object_id and yield to the block.

In Ruby’s semantics, these three uses are identical. In the first case, yield calls an implicit Proc object. In the second case, it takes an explicit Proc, then sends it on to the next method. In the last case, it takes an explicit Proc, but yields to the implicit copy of the same object.

So what’s the & thing for?

In Ruby, in addition to normal arguments, methods can receive a Proc in a special slot. All methods can receive such an argument, and Procs passed in that slot are silently ignored if not yielded to:

def foo
  puts "HELLO"
foo { something_crazy } #=> "HELLO"

On the other hand, if you want a method to receive a Proc in that slot, and thus be able to yield to it, you specify that by prefixing it with an &:

def foo
my_proc = Proc.new { puts "HELLO" }

Here, you’re telling the foo method that my_proc is not a normal argument; it should be placed into the proc slot and made available to yield.

Additionally, if you want access to the Proc object, you can give it a name:

def foo(&block)
  puts block.object_id
foo { puts "HELLO" } #=> "2148084320\nHELLO"

This simply means that you want access to the implicit Proc in a variable named block.

Because, in most cases, you’re passing in a block (using do/end or {}), and calling it using yield, Ruby provides some syntax sugar to make that simple case more pleasing. That does not, however, mean that there is a special block construct in Ruby’s semantics, nor does it mean that the & is casting the a block to a Proc.

You can tell that blocks are not being semantically wrapped and unwrapped because blocks passed along via & share the same object_id across methods.

Mental Models

For the following code there are two possible mental models.

def foo(&block)
  puts block.object_id
b = Proc.new { puts "OMG" }
puts b.object_id
foo(&b) #=> 2148084040\n2148084040\nOMG

In the first, the &b unwraps the Proc object, and the &block recasts it into a Proc. However, it somehow also wraps it back into the same wrapper that it came from into the first place.

In the second, the &b puts the b Proc into the block slot in foo’s argument list, and the &block gives the implicit Proc a name. There is no need to explain why the Proc has the same object_id; it is the same Object!

These two mental models are perfectly valid (the first actually reflects Ruby’s internal implementation). I claim that those who want to use the first mental model have the heavy burden of introducing the new concept to the Ruby language of a non-object block, and that as a result, it should be generally rejected.


Similarly, in Ruby’s internal implementation, an Object does not get a metaclass until you ask for one.

obj = Object.new
# internally, obj does not have a metaclass here
# internally, Ruby skips right up to Object when searching for #to_s, since
# it knows that no metaclass exists
def obj.hello
  puts "HELLO"
# now, Ruby internally rewrites obj's class pointer to point to a new internal
# metaclass which has the hello method on it
# Now, Ruby searches obj's metaclass before jumping up to Object
# Now, Ruby skips the search because it's already cached the method
# lookup

All of the comments in the above snippet are correct, but semantically, none of them are important. In all cases, Ruby is semantically looking for methods in obj’s metaclass, and when it doesn’t find any, it searches higher up. In order to improve performance, Ruby skips creating a metaclass if no methods or modules are added to an object’s metaclass, but that doesn’t change Ruby’s semantics. It’s just an optimization.

By thinking in terms of Ruby’s implementation, instead of Ruby’s semantics, you are forced to think about a mutable class pointer and consider the possibility that an object has no metaclass.

Mental Models

Again, there are two possible mental models. In the first, Ruby objects have a class pointer, which they manipulate to point to new metaclass objects which are created only when methods or modules are added to an object. Additionally, Ruby objects have a method cache, which they use to store method lookups. When a method is looked up twice, in this mental model, some classes are skipped because Ruby already knows that they don’t have the method.

In the second mental model, all Ruby objects have a metaclass, and method lookup always goes through the metaclass and up the superclass chain until a method is found.

As before, I claim that those who want to impose the first mental model on Ruby programmers have the heavy burden of introducing the new concepts of “class pointer” and “method cache”, which are not Ruby objects and have no visible implications on Ruby semantics.

Regular Expression Matches

In Ruby, certain regular expression operations create implicit local variables that reflect parts of the match:

def foo(str)
  str =~ /e(.)l/
  p $~
  p $`
  p $'
  p $1
  p $2
foo("hello") #=> #<MatchData "ell" 1:"l">\n"h"\n"o"\n"l"\nnil

This behavior is mostly inherited from Perl, and Matz has said a few times that he would not support Perl’s backrefs if he had it to do over again. However, the provide another opportune example of implicit objects in Ruby.

Mental Models

In this case, there are three possible mental models.

In the first mental model, if you don’t use any $ local variables, they don’t exist. When you use a specific one, it springs into existence. For instance, when using $1, Ruby looks at some internal representation of the last match and retrieves the last capture. If you use $~, Ruby creates a MatchData object out of it.

In the second mental model, when you call a method that uses regular expressions, Ruby walks back up the stack frames, and inserts the $ local variables on it when it finds the original caller. If you later use the variables, they are already there. Ruby must be a little bit clever, because the most recent frame on the stack (which might include C frames, Java frames, or internal Ruby frames in Rubinius) is not always the calling frame.

In the last mental model, when you call a method that uses regular expressions, there is an implicit match object available (similar to the implicit Proc object that is available in methods). The $~ variable is mapped to that implicit object, while the $1 variable is the equivalent of $~[1].

Again, this last mental model introduces the least burdensome ideas into Ruby. The first mental model introduces the idea of an internal representation of the last match, while the second mental model (which again, has the upside of being how most implementations actually do it) introduces the concept of stack frames, which are not Ruby objects.

The last mental model uses an actual Ruby object, and does not introduce new concepts. Again, I prefer it.


In a number of places, it is possible to imbue Ruby semantics with mental models that reflect the actual Ruby implementation, or the fact that it’s possible to imagine that a Ruby object only springs into existence when it is asked for.

However, these mental models require that Ruby programmers add non-objects to the semantics of Ruby, and requiring contortions to explain away Ruby’s own efforts to hide these internals from the higher-level constructs of the language. For instance, while Ruby internally wraps and unwraps Procs when passing them to methods, it makes sure that the Proc object attached to a block is always the same, in an effort to hide the internal details from programmers.

As a result, explaining Ruby’s semantics in terms of these internals requires contortions and new constructs that are not natively part of Ruby’s object model, and those explanations should be avoided.

To be clear, I am not arguing that it’s not useful to understand Ruby’s implementation. It can, in fact, be quite useful, just as it’s useful to understand how C’s calling convention works under the covers. However, just as day-to-day programmers in C don’t need to think about the emitted Assembler, day-to-day Ruby programmers don’t need to think about the implementation. And finally, just as C implementations are free to use different calling conventions without breaking existing processor-agnostic C (or the mental model that C programmers use), Ruby implementations are free to change the internal implementation of these constructs without breaking pure-Ruby code or the mental model Ruby programmers use.

New Relic RPM Officially Supports Rack and Sinatra – Finally!

This post is by Peter Cooper from Ruby Inside

Click here to view on the original site: Original Post

NewRelic_inline.pngNew Relic’s RPM, an application performance monitoring and reporting system, has today announced it has added full support for Sinatra and Rack-based Ruby applications to its traditionally Rails-centric service. It’s been possible to hack in support for non-Rails apps into New Relic before, but this move brings them officially into the fold with all of the features only Rails apps used to be able to take advantage of.

New Relic’s press release on the news includes a typically “press release sounding” quote from Ryan Tomayko, but as a key contributor to Sinatra and Rails, and as a GitHub employee, it seems worth quoting:

Rack has given Ruby web developers a tremendous amount of freedom to innovate and experiment with new ways of building web applications.

Developers are increasingly turning to Rack and lightweight frameworks like Sinatra for small utility apps or for latching performance critical features onto an existing site. The ability to monitor and profile these applications using New Relic RPM fills a huge visibility gap for us.

So there you go. New Relic have also updated the “agent” that’s used to communicate between your apps and their servers and added some Ruby specific features including enhanced visibility in garbage collection, developer mode profiling, “enhanced” JRuby support, and Phusion Passenger queue time capturing (this sounds particularly useful for tweaking your stack).

As always, New Relic RPM is free to use at a “Lite” level and if you’re a new user, they’ll give you a week of “Gold” level features for free to sweeten the deal. You can keep running at Lite after that though if you don’t want to pay. The “Bronze” plan starts at $50 per month (on an annual basis) per host but they also have an “on demand” Amazon EC2 style pricing structure starting from 10 cents per hour.

We’ve been keeping an eye on New Relic since early 2008 and they seem to have gone from strength to strength over the years. Early on, FiveRuns‘ RM-Manage was still a better option than RPM (in my opinion) but with FiveRuns going the way of the dodo recently, New Relic have become the main game in town when it comes to Ruby webapp performance monitoring (though Scout are giving them a run for their money in certain areas).

Building A Well Formed Number Handling Class From Scratch

This post is by Peter Cooper from Ruby Inside

Click here to view on the original site: Original Post

Over on the Ruby Best Practices blog, somenums.pngRobert Klemme walks through the process of building a new numeric class from scratch in Ruby – taking into account all the gotchas and considerations that pop up along the way. Robert’s task is harder and more involved than you’d initially suspect.!

Robert chooses to build a HexNum class that can represent integers that are then displayed as hex numbers. There are considerations to be made with handling conversions from existing numeric types and his new HexNum class, conversions to other types, supporting standard comparison methods, and overloading.

All of the above concerns are covered in the post with all the quality and detail you should expect from the RBP blog by now. This post in particular should prove interesting to most Ruby developers who feel happy digging deep (no, this isn’t an article for beginners!).

[job] BeenVerified.com is currently looking for a Ruby and Rails developer to join their team in New York City. Alternatively, check out one of the other 12 jobs on our Ruby jobs board!

How Ruby Manages Memory and Garbage Collection

This post is by Peter Cooper from Ruby Inside

Click here to view on the original site: Original Post

garbage.jpgGarbage Collection and the Ruby Heap is a presentation given by Joe Damato and Aman Gupta at the recent LA Ruby Conference. You only get the slides for now (all 70 of them!), but they’re very detailed and can almost work as a standalone concise e-book on Ruby’s garbage collection system.

Joe and Aman take a look at C memory management vs Ruby and show the difference between the stack and the heap. As a garbage collected language, Ruby takes the easy route by putting everything on the heap and the presentation demonstrates how the MRI (Matz’s Ruby 1.8) does this, as well as how objects are tracked within memory (right down to the underlying C structs).


MRI’s garbage collection scheme isn’t particularly well optimized (though Phusion’s Ruby Enterprise Edition has made some tweaks) and the presentation demonstrates the viability of some other garbage collection schemes (as always, the issue is compatibility with native extensions).

The presentation finishes off with a interesting walkthrough of using memprof (a Ruby memory profiler) to debug a memory leak in Rails 3.

[e-book] The Rails 3 Upgrade Handbook by Jeremy McAnally is a 120 page guide on migrating your apps from Rails 2.x to Rails 3.0. There’s a review of it on Rails Inside if you want to learn more.

5 Chapters of O’Reilly’s Ruby Best Practices – Free!

This post is by Peter Cooper from Ruby Inside

Click here to view on the original site: Original Post

rbp.pngRuby Best Practices is a book by Gregory Brown (and published by O’Reilly) that looks into the “Ruby way” of doing things in the Ruby language and, specifically, why Rubyists tend to write Ruby the way they do. It’s an engaging book and we took a look at it and interviewed Gregory Brown about it just over a year ago.

Gregory always wanted to be able to give away his book with a Creative Commons license eventually and O’Reilly have kindly allowed him to start doing that, a chapter at a time. So far, the first five chapters are available to download at GitHub (in PDF format). Specifically:

However, it’s not just a free for all! If you read these chapters, Gregory (the primary author of the book) implores you to comment and offer any advice or insights you might have on the relevant posts on the RBP blog.. he also suggests that if you really like it, you should buy a copy of the book somehow, if only to convince O’Reilly that this publishing model is a “Good Thing.” Gregory claims that the book hasn’t even made its advance back yet (how!?), which makes this gesture all the better.

To buy a copy, head over to O’Reilly for e-book and print copies or go to your usual bookselling site (Amazon.com are probably the cheapest as usual).

Kudos to Gregory and O’Reilly for this move.

Winter 2009 Survey Results

This post is by Heroku from Heroku

Click here to view on the original site: Original Post

In December we asked our users to take a survey on how they are using Heroku. After collecting the responses, we wanted to share some of the results with the rest of our user community.

Who’s using Heroku?
No surprise, but the majority identify themselves as in the “Software Technology” industry, at 65% of the respondents. The rest of the user base is divided between many groups, from Consultancies with 9%, to the Arts & Entertainment industry with 6% and Healthcare at 2.5%. Respondents reported annual web application budgets as high as $10M/year, with over 13 spending >$100K/annually.

How are they using Heroku?
These users are building a huge range of applications, and often more than one per user:

55.6% of respondents are now or shortly deploying production applications onto Heroku.

Respondents are at the cutting edge of cloud technology. Characteristics of these applications include thorough caching strategies, asynchronous patterns, and alternatives to traditional relational databases.

Reasons for moving to the cloud

In a strong shift from previous studies, respondents said loud and clear that agility is the #1 reason to move to the cloud. Cost, previously the #1 response, only just made it into the top 5 in this survey.

We thank all the people who took the time to fill out the survey, and hope you find the results as interesting as we do!

RPCFN: Broadsides (#7)

This post is by Satish Talim from RubyLearning Blog

Click here to view on the original site: Original Post

Ruby Programming Challenge For Newbies

RPCFN: Broadsides (#7)

By James Edward Gray II

About James Edward Gray II

James Edward Gray IIJames Edward Gray II was called into the principal’s office in high school for writing a black jack program on his calculator and beaming it to all the math students almost 20 years ago. He’s been tinkering with little code challenges ever since. After discovering Ruby, he formalized this process by creating the Ruby Quiz. Though he no longer runs those challenges, he’s glad to see that the spirit lives on in projects like the RPCFN.

James has this to say about the challenge:

The only way to learn to program is to have about 5,000 arguments with a compiler, in my opinion. How you get your time in is up to you, but I would rather do it with fun little exercises like the RPCFN than under more stressful circumstances. Given that, I tend to favor the game problems as they distract me from the learning I am really trying to accomplish and allow me to have more fun.

Our Awesome Sponsors

This monthly programming challenge is co-sponsored by 1st Easy Limited and Backup My App.

UK based Passenger Hosting

1st Easy Limited are delighted to have been given the opportunity to support the work of Satish Talim and his team at RubyLearning.

Taking part in the Ruby Programming Challenge? You’re welcome to take advantage of the free Ruby on Rails hosting trials that 1st Easy offer: simply register your details, and a full-featured account is yours to do with as you please for one month. Once the trial is over, you can transfer your work to a paid account, or walk away with no questions asked!

Backup My App

Backup My App is an automatic backup service for Ruby on Rails applications. You simply install the plugin to your Rails application and they handle the rest of the process. They store backup history for several weeks and you can restore any of them automatically. Try out their 1 GB plan for free. Backup My App has co-sponsored this challenge and is proud to make this contribution to the Ruby community.


  • The participant with the best Ruby solution (if there is a tie between answers, then the one who posted first will be the winner) will be awarded any one of PeepCode’s Ruby on Rails screencasts and a free 10 GB account for a year from Backup My App.
  • From the remaining working Ruby solutions, three participants would be selected randomly and each one would be awarded any one of Pragmatic’s The Ruby Object Model and Metaprogramming screencasts.
  • All the participants in this challenge (except the participant with the best Ruby solution) will get a free 5 GB account for 6 months from Backup My App.

The four persons who win, can’t win again in the next immediate challenge but can still participate.

The Ruby Challenge


The Challenge

The entire challenge details are available at: http://github.com/JEG2/broadsides.

How to Enter the Challenge

Read the Challenge Rules. By participating in this challenge, you agree to be bound by these Challenge Rules. It’s free and registration is optional. You can enter the challenge just by posting the following as a comment to this blog post:

  1. Your name:
  2. Country of Residence:
  3. GIST URL of your Solution (i.e. Ruby code) with explanation and / or test cases:
  4. Code works with Ruby 1.8 / 1.9 / Both:
  5. Email address (will not be published):
  6. Brief description of what you do (will not be published):


  • As soon as we receive your GIST URL, we will fork your submission. This means that your solution is frozen and accepted. Please be sure that is the solution you want, as it is now recorded in time and is the version that will be evaluated.
  • All solutions posted would be hidden to allow participants to come up with their own solutions.
  • You should post your entries before midnight of 31st Mar. 2010 (Indian Standard Time). No new solutions will be accepted from 1st Apr. onwards.
  • On 3rd Apr. 2010 all the solutions will be thrown open for everyone to see and comment upon.
  • The winning entries will be announced on this blog before 10th Apr. 2010. The winners will be sent their prizes by email.

More details on the RPCFN?

Please refer to the RPCFN FAQ for answers to the following questions:


RPCFN is entirely financed by RubyLearning and sometimes sponsors, so if you enjoy solving Ruby problems and would like to give something back by helping with the running costs then any donations are gratefully received.

Click here to lend your support to: Support RubyLearning With Some Love and make a donation at www.pledgie.com !


Special thanks to:

  • James Edward Gray II.
  • Sponsors 1st Easy Limited and Backup My App.
  • GitHub, for giving us access to a private repository on GitHub to store all the submitted solutions.
  • The RubyLearning team, namely Jeff Savin (Canada), Peter Crawford (Italy), Satoshi Asakawa (Japan) and Victor Goff III (USA).


Contact Satish Talim at satish [dot] talim [at] gmail.com OR if you have any doubts / questions about the challenge (the current problem statement), please post them as comments to this post and the author will reply asap.

The Participants

There are two categories of participants. Some are vying for the prizes and some are participating for the fun of it.

In the competition

Just for Fun

Previous Challenge

RPCFN: Fair Distribution (#6) by John Trupiano.

Note: All the previous challenges, sponsors and winners can be seen on the Ruby Programming Challenge for Newbies page.


  • The (#8) challenge by Jamie van Dyke, UK is scheduled for 9th Apr. 2010.

Technorati Tags: , , , , ,

Ruby and Rails Conferences 2010

This post is by Gregg Pollack from Riding Rails - home

Click here to view on the original site: Original Post

There are an incredible amount of Ruby & Rails conferences coming up in the next 6 months. See below to find one in your neck of the woods.

MountainWest RubyConf

March 11-12 – MountainWest RubyConf in Salt Lake City, UT, USA

Cost: 100 USD

Rails Camp New England

March 12-15 – Rails Camp New England in West Greenwich, RI, USA

Cost: 150 USD

RubyConf India

March 20-21 – RubyConf India in Bangalore, India

Cost: 1000 INR

Scottish Ruby Conference

March 26-27 – Scottish Ruby Conference in Edinburgh, Scotland

Cost: 195 GBP

Ruby Nation

April 9-10 – Ruby Nation in Reston, VA, US

Cost: 259 USD

RailsCamp Canberra

April 16-19 – RailsCamp Canberra in Canberra Australia

Cost: 210 AUD

Great Lakes Ruby Bash

April 17 – Great Lakes Ruby Bash in Lansing, MI, USA

Cost: ?

RubyConf Taiwan

April 25 – RubyConf Taiwan in Taipei, Taiwan

Cost: 400 TWD

ArrrrCamp #3

April 30 – ArrrrCamp #3 in Ghent, Belgium

Cost: Free

Red Dirt RubyConf

May 6-7 – Red Dirt RubyConf in Oklahoma City, OK, USA

Cost: ?

Frozen Rails

May 7 – Frozen Rails in Helsinki, Finland

Cost: 99 EUR

Nordic Ruby

May 21-23 – Nordic Ruby in Gothenburg, Sweden

Cost: ?


May 22 – GoRuCo in New York, NY

Cost: ?


May 29-30 – Euruko in Krakow, Poland

Cost: ?


May 31-June 2 – RailsWayCon in Berlin, Germany

Cost: 699 EUR


June 7-10 – RailsConf in Baltimore, MD, USA

Cost: $695

Ruby Midwest

July 16-17 – Ruby Midwest in Kansas City, MO

Cost: $75

RS on Rails

August 21 – RS on Rails in Porto Alegre, Brazil

Cost: R60

Lone Star Ruby Conference

August 26-28 – Lone Star Ruby Conference in Austin, TX, USA

Cost: ?

Ruby Kaigi

August 27-29 – Ruby Kaigi in Tsukuba, Ibaraki, Japan

Cost: ?

If I missed any (or have any information wrong) feel free to leave a comment and I’ll add it to the post. FYI, I’m purposely only showing conferences in the next 6 months. I’ll do another post in 6 months to show additional ones.

#202 Active Record Queries in Rails 3

This post is by RailsCasts from RailsCasts

Click here to view on the original site: Original Post

Rails 3 introduces a new query interface for performing finds in Active Record. See how it works along with the changes in named scopes.

#202 Active Record Queries in Rails 3

This post is by RailsCasts from RailsCasts

Click here to view on the original site: Original Post

Rails 3 introduces a new query interface for performing finds in Active Record. See how it works along with the changes in named scopes.

Showcasing RubyLearning’s Awesome Rubyists

This post is by Satish Talim from RubyLearning Blog

Click here to view on the original site: Original Post

Showcasing RubyLearning’s Awesome Rubyists

RubyLearning has been associated with some amazing, talented Rubyists these last 5 years. I am compiling a list (in alphabetical order) showcasing these awesome Rubyists who have either undergone some of the courses at RubyLearning or have been instrumental in taking RubyLearning to the next level.

Ruby Stars

Alvaro Pereyra Rabanal

Alvaro Pereyra Rabanal

Alvaro Pereyra Rabanal is based in Peru. Currently, he has started teaching Ruby and Rails and he is about to finish the first batch. He adds that so far, it’s been wonderful and every student has been amazed by the awesomeness of Ruby. He also leads one of only Ruby shops in Peru, working on the biggest Rails site around there and has just started their new SaaS secret project, powered by Rails 3.0.

  • Contact Email Id
  • Educational Qualifications: B.S. Computer Science.
  • Working at his own devshop, Xenda (still available for new projects).
  • Ruby / Rails Blog URL: NA
  • GitHub URL
  • LinkedIn profile URL
  • Twitter Id
  • Other Interests: Programming (he just loves it), reading and writing short-stories.

Anil Maruti Wadghule

Anil Maruti Wadghule

Anil Maruti Wadghule is based in Pune, India and has worked as lead developer for Giftlasso.com, Taskbin.com, Purpletrail.com and Eventuity.com. Personally, as side projects, he has written some small apps like:

He has also contributed to Rails plugin named sql_session_store. With pure Ruby, he has written lots of backend scripts, tasks required for the projects.

  • Contact Email Id
  • Educational Qualifications: BE – Computer Engineering, Pune University 2006.
  • Employed with Calsoft as Senior Development Engineer.
  • Ruby / Rails Blog URL: NA
  • GitHub URL
  • LinkedIn profile URL
  • Twitter Id
  • Other Interests: Listening to music, travelling, reading books, watching movies. He is a die-hard of A. R. Rahman and likes to buy all his music CDs. 90% of his music CDs is of A. R. Rahman.

Bruce Scharlau

Bruce Scharlau

Bruce Scharlau is based in Scotland, UK and has been teaching about Ruby / Rails since 2006 to undergraduate and postgraduate students. He has supervised a number of group and MSc projects using Rails, including one as part of RailFrog. He gave a presentation on this at last years’ Scotland on Rails conference. This year he’s doing a similar one focusing on just Ruby to the Scottish Ruby Conference.

Dan Wanek

Dan Wanek

Dan Wanek is based in the USA. For his job he uses Ruby to aid in process automation where he once used Perl to do the vast majority of things. He has also been using it to automate web testing with Selenium. In his free time he does some hobby programming and has been working on client access programs to both MS Exchange Web Services (Viewpoint) and MS Sharepoint Web Services (Viewpoint-SPWS).

Daniel Kotowski

Daniel Kotowski

Daniel Kotowski is based in Poland and created a blog using Ruby on Rails. For everyday problems he uses Ruby (more often than C++)!

Dr Nic Williams

Dr Nic Williams

Dr Nic Williams is based in Australia and since 2006 has created or maintains dozens of projects for Ruby (newgem, github-gem), Rails (composite_primary_keys, magicmodels), JavaScript (github-badge, jsunittest) and TextMate (Ruby on Rails, Cucumber).

Eric Fer

Eric Fer

Eric Fer is based in Brazil and has worked on the best blog aggregator in Portuguese language, BlogBlogs in Rails; has dedicated the last month on a proprietary CMS in Rails, and currently working on a high scale distributed system in Ruby/Rails (also proprietary). For the Ruby community he has dedicated his time teaching Core Ruby at RubyLearning.org

Ian Dees

Ian Dees

Ian Dees is based in the USA.

  • Author, _Scripted GUI Testing With Ruby_, Pragmatic Programmers
  • Brominet (network-enabled version of Felipe Barreto and Matt Gallagher’s “Bromine” iPhone GUI testing library)
  • RForce (Ruby bindings to SalesForce)
  • The occasional patch or two to JRuby, RSpec, and other projects

Jeff Savin

Jeff Savin

Jeff Savin is based in Canada and with Ruby has done custom scraping and web automation applications for small businesses. With Rails, he is maintaining social websites for Spork Labs.

  • Contact Email Id
  • Educational Qualifications: B.S. Computer Science, California State University, Los Angeles.
  • Employed. Ruby and Ruby/Rails Contractor, currently with Spork Labs, LLC.
  • Ruby / Rails Blog URL: NA
  • GitHub URL
  • LinkedIn profile URL: NA
  • Twitter Id
  • Other Interests: MMORPGs, reading and raising 6 boys.

John Trupiano

John Trupiano

John Trupiano is based in Baltimore, MD, USA. Most notably he is the creator of the Timecop and Rack::Rewrite RubyGems. They have been building Rails web applications at SmartLogic for the past three years. He is also an instrumental member of the Baltimore Ruby/Rails users group Bmore on Rails and have presented there on Passenger/Capistrano, quality control, and rvm. He’s active in the Ruby OSS community with contributions to Rails, Capistrano, Shoulda, Factory_girl and Gemcutter.

Julio Javier Cicchelli

Julio Javier Cicchelli

Julio Javier Cicchelli is an Argentinean living in the Red Light District, Amsterdam, The Netherlands. During the last couple of years he has been working mainly on delivering systems, websites and web applications. His main programming language is Ruby but also has been exploring the frontiers with Erlang, Objective-C and Javascript. Nowadays he is working a lot with Rack & Sinatra and experimenting with SproutCore, JRuby and MacRuby in his free time.

  • Contact Email Id
  • Educational Qualifications: Software Engineering degree (in both Argentina and France) and Master in Information Technology in France.
  • Technology and Engineering director of Rock & Code
  • Ruby / Rails Blog URL: NA
  • GitHub URL
  • LinkedIn profile URL
  • Twitter Id
  • Other Interests: He likes to read comics (especially Marvel Comics), movies (every movie that allows you to have some pop-corn and beer is fine by him), drawing, video games (he has been having a blast with his Wii for the last couple of years!), sports, music (he listens to good ol’ fashioned Rock & Roll, 60s Psychedelic Rock, 70’s Hard Rock, 80s Glam, Heavy and Trash Metal essentially even tough he loves to listen to Blues and Jazz from time to time) and radio DJing(he has two Internet radio shows: “Rock & Roll” and “Hangover” every Friday and Sunday evenings respectively!)

Milan Dobrota

Milan Dobrota

Milan Dobrota is based in Serbia and currently working on a cool project that lets you create and edit a wiki with MS Word. Other than that he has been working on a lot of projects including: http://www.listyourdebt.com/, http://eipon.com/, http://marketmonitorhq.com/ and a couple more that are yet to be launched.

Nícolas Faccin Iensen

Nícolas Faccin Iensen

Nícolas Faccin Iensen is based in Brazil and has completed work on a simple website with dynamic content – very enlightening for the first approach on the MVC pattern. Next he built a human relations system, a great RoR case. At last, the big IDEA that is still in development: an amazing project that he hopes to use as their first product – an example of Rails + Ajax power.

  • Contact Email Id
  • Graduating in Computer Science
  • Founder of Quavio.
  • Ruby / Rails Blog URL: NA
  • GitHub URL: NA
  • LinkedIn profile URL: NA
  • Twitter Id
  • Other Interests: Project management, agile culture, new technologies, internet and so on…

Sandip Ransing

Sandip Ransing

Sandip Ransing is based in Pune, India and works at Josh Software Pvt. Ltd . In Josh, he has worked as a developer on brandpotion.com, a unique creative community social networking site, paisamatters.com, a loan comparison site and also for an ERP solution for a call center management system using adhearsion. He is currently working on creating custom extensions for a RadiantCMS based multi-site hosting.

He has:

His other details:

Saurabh Bhatia

Saurabh Bhatia

Saurabh Bhatia is based in Mumbai, India. He:

  • has been working with Ruby and Rails since 2005 and is the founder of Safew Labs.
  • is very enthusiastic and always focussed upon building community.
  • is the founder and moderator of Bangalore Ruby Users Group.
  • has touched almost every aspect of Ruby, right from native Ruby programming, Rails, for web apps to Desktop apps like Titanium, Ruby Qt and Shoes.
  • writes for Rails Magazine and provides Rails tutorials at wdvl.internet.com.
  • is an active member at Shoes and Adva CMS communities.

Other details are:

Saurabh Purnaye

Saurabh Purnaye

Saurabh Purnaye is based in Pune, India and has created applications in RoR: designbyhumans.com and aberoncs.com.

Willian Molinari

Willian Molinari

Willian Molinari is based in Brazil and has worked with different Rails applications. The first is a large content website and the last is his current job (Social Network). He has a work in progress 2D game like arkanoid (using Ruby and Gosu).

  • Contact Email Id
  • Educational Qualifications: Studying (2 years left) “Information systems” at Santo André Foundation (bachelor course).
  • Employed. A Brazilian social network to guide people on how to choose a course to study and a occupation to work – www.ikwa.com.br
  • Ruby / Rails Blog URL (in Portuguese and not *ALL* about Ruby).
  • GitHub URL
  • LinkedIn profile URL
  • Twitter Id: WillianMolinari (English) and PotHix (Portuguese).
  • Other Interests: Interested in a lot of different things. In programming he really likes Ruby (obviously), but he likes to know other languages like Python, C++, PHP, Javascript and so on. He likes to develop games, which is an interesting area in programming that stimulates him to have fun. On the non-programming subjects he’s interested in photography and music (he likes to play the guitar and drums).

Upcoming Ruby Stars

Braxton Gregory Smith

Braxton Gregory Smith

Braxton Gregory Smith is based in the USA and has just started learning Ruby. He has already created an image gallery in Rails and a few Ruby programs to automate tasks.

  • Contact Email Id
  • Working on his computer science BS and psychology BS at BYU Hawaii.
  • Currently Unemployed..
  • Blog URL: A blog on whatever he is learning.
  • GitHub URL
  • LinkedIn profile URL: NA
  • Twitter Id
  • Other Interests: Hiking, biking, surfing, running, computer science and psychology.


I’ll be updating this page from time to time. If you have been associated with RubyLearning in some way or the other, use Ruby at work or as a hobby and would like your information displayed here, please email me at satish [dot] talim [at] gmail.com.

Thank you for your time and help.

Technorati Tags: , , ,