m.onkey.org Archives - 21 September 2017, Thursday

  • Stop returning false from your before filters

    m.onkey.org 04 Jan '14, 9am

    Stop returning false from your before filters Published over 4 years ago In the past version of Rails you had to explicitly return false from before filters to halt the filter chain and make sure the action doesn’t get run. The code looked somewhat like : class AdminController < Appli...

  • Ruby I don't like #3 - Object#freeze

    m.onkey.org 30 Nov '13, 10am

    However, above are not really the primary reasons I don’t like freeze . It’s the fact that you cannot unfreeze an object without using something like evil.rb . And this goes against a lot of things Ruby stands for in my book. Ruby is never about defensive programming. Even where it tr...

  • Active Record Query Interface 3.0

    m.onkey.org 25 Nov '13, 3am

    I’ve been working on revamping the Active Record query interface for the last few weeks ( while taking some time off in India from consulting work, before joining 37signals ), building on top of Emilio’s GSOC project of integrating ARel and ActiveRecord. So here’s an overview of how t...

  • Thread safety for your Rails

    m.onkey.org 17 Sep '13, 11pm

    Rails 2.2 marks the first release of thread safe Rails. But “thread safety” alone, without any context, doesn’t mean shit. When people say Rails is “thread safe” ( or otherwise ), they usually refer to the dispatching process of Rails. Before 2.2, Rails dispatching looked like :

  • Ruby on Rack #1 - Hello Rack!

    m.onkey.org 04 Aug '13, 11pm

    Rack is a framework to roll your own ruby framework. Rack provides an interface between different web servers and your framework/application. Making it very simple for your framework/application to be compatible with any webserver that supports Rack – Phusion Passenger, Litespeed, Mon...

  • Private method called

    m.onkey.org 08 Jun '13, 10pm

    Here, I’d expect ruby to throw up with “private method `secret’ called for # (NoMethodError)” error. But it just leans over to method_missing() . That kinda makes sense, considering Ruby completely hides private methods and throws NoMethodError. But playing around with this a little m...

  • Faster eager loading and funky joins

    m.onkey.org 08 Jun '13, 10pm

    I was able to spend some time on a flight and at home to work on a very annoying performance pit associated with eager loading association’s instantiation code. So, with changeset 8051 , hopefully you should see some performance improvement with eagerloading associations with large da...

  • Default Scopes and Inheritance to the rescue - (m.onkey.org)

    m.onkey.org 08 Jun '13, 10pm

    On my one of the current projects, there are two primary models each with a flag called approved_. 99% of the front end part deals with only approved items. Unapproved items are usually only in the admin panel side of the story. So I started with using a named

  • Active Record batch processing in parallel processes

    m.onkey.org 08 Jun '13, 10pm

    Active Record batch processing in parallel processes Published almost 2 years ago Active Record provides find_each for batch processing of large number of records. However, when you are dealing with REALLY larger number of records ( I’m talking millions here ), find_each can become qu...

  • Bulk ALTER TABLE with Rails 3 and MySQL - (m.onkey.org)

    m.onkey.org 27 Mar '13, 2am

    Bulk ALTER TABLE with Rails 3 and MySQL Published about 2 years ago With this commit , Rails migrations will support adding/removing/changing multiple columns via a single ALTER TABLE statement for MySQL. Let’s say you need to add 2 new columns to a table and modify data type of anoth...

  • Using ruby-debug with Pow - (m.onkey.org)

    m.onkey.org 22 Mar '13, 10pm

    has_many :bugs, :through => :rails Using ruby-debug with Pow Published over 1 year ago After moving to Sam Stephenson’s awesome Pow , not being able to use ruby-debug was the primary obstacle I had adjusting to my new development environment. But as it turns out, it’s very simple to u...

    1. Using ElasticSearch with Ruby rubyflow.com 22 Mar '13, 11am
  • Let's start with wtf!? - (m.onkey.org)

    m.onkey.org 06 Apr '12, 7am

    Let's start with wtf!? Published almost 5 years ago UPDATE : Check Ticket 8818 Welcome to my new blog :) Now over to rails.. So you’ve been told about using cute shortcuts for enumerator like Post.find(:all).map(&:title) – you feel great using it, don’t you ?? And you laughed at those...