Tag Archives: ruby

Thank You, Magic Ruby!

Thanks for all the kind comments on my Exceptional Ruby talk! A few notes for those visiting because of the talk: References, source code, links to further reading, and yes, slides can be found here: Exceptional Ruby Notes. Please review … Continue reading

Posted in Conferences | Tagged , , , , , , | 2 Comments

The happy developer

The programmer has a fixed amount of time and concentration that he can give every day. He must give a bigger piece of the pie to the bad technologies, simply because they require more. In other words, he ends up spending most … Continue reading

Posted in Rants | Tagged , , , , , , | 3 Comments

ActiveRecord association extensions and method_missing

The semantics of method calls in Ruby are simple: Call the named method; or If no method exists, call #method_missing() instead. Normally #send() obeys these rules as well. ActiveRecord association proxies mangle #send()‘s semantics, however, violating the POLS and potentially … Continue reading

Posted in Ruby | Tagged , , , , , , | 12 Comments

ActiveRecord Golf

So I was messing around with some scratchpad code today, investigating the use of with_exclusive_scope, and here’s what I had to write to come up with a minimal working ActiveRecord model: require ‘rubygems’ require ‘active_record’ ActiveRecord::Base.establish_connection( :adapter => “sqlite3″, :database … Continue reading

Posted in Ruby | Tagged , , , | 3 Comments

Glass Houses for Ruby

A little something for Giles et. al. who feel that private has no business in the Ruby language… # Privacy? We don’t need no stinkin’ privacy! module TSA def private # NOOP end def protected # NOOP end end class … Continue reading

Posted in Ruby | Tagged , , | 7 Comments

Daniel Spiewak on Monads

Anyone trying to understand monads will inevitably run into Haskell’s IO monad, and the results are almost always the same: bewilderment, confusion, anger, and ultimately Perl. via Monads Are Not Metaphors – Code Commit. A thoroughly enjoyable read, recommended.

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

Object Oriented Programming Comes to Rails

decent_exposure helps you program to an interface, rather than an implementation in your Rails controllers. Sharing state via instance variables in controllers promotes close coupling with views. decent_exposure gives you a declarative manner of exposing an interface to the state … Continue reading

Posted in Rails, Rants, Ruby | Tagged , , , | 5 Comments

A Rack-like library for HTTP Clients

Faraday is an HTTP client library inspired by Rack. Requests and Responses go through middleware which allow for abstraction and modular code. via Writing modular HTTP client code with Faraday | Adventures In Coding. Strike that off my list of … Continue reading

Posted in Ruby | Tagged , , , | 1 Comment

RVM Proxies for Common Commands? (Solved)

I posted this in IRC earlier but I thought I’d ask a larger audience: (01:39:01 PM) avdi: So here’s my problem (01:39:55 PM) avdi: My emacs is set up to run various Ruby/Rails-related commands within projects, e.g. “rake cucumber”, as … Continue reading

Posted in Questions, Ruby | Tagged , , , | 5 Comments

Counters for Partials

Sometimes I like to number rows using a counter when rendering lists of things: <% @products.each_with_index do |product, i| %> <li class=”product_<%= i %>”><%= product.name %></li> <% end %> They are handy for testing, among other things. Of course, if … Continue reading

Posted in Rails, Ruby | Tagged , , , , | 2 Comments