Tonyamoyal - tonyamoyal.com - Tony Amoyal
General Information:
Latest News:
Recursive custom to_json in Ruby for arrays of objects or nested objects 26 Mar 2011 | 02:42 am
Let’s say we want to customize the json template for an object: Apparently this is fixed in Ruby 1.9 but for now only converting an object directly to custom json works: Cool but we want that to wor...
Recursive custom to_json in Ruby for arrays of objects or nested objects 25 Mar 2011 | 10:42 pm
Let’s say we want to customize the json template for an object: class User def to_json super(:except => [:password, :password_salt, :encrypted_password, :last_sign_in_ip, :updated_at, :current_sign_i...
Deduping join data in ruby based on multiple attributes 24 Mar 2011 | 03:53 pm
In the past I created an app using Rails built in HABTM and no unique index on the join tables. I’m more into the has_many :through choice today. In order to migrate my data with a unqiue index, I ha...
Deduping join data in ruby based on multiple attributes 24 Mar 2011 | 11:53 am
In the past I created an app using Rails built in HABTM and no unique index on the join tables. I’m more into the has_many :through choice today. In order to migrate my data with a unqiue index, I had...
More cool stuff with ruby’s tap method 29 Jan 2011 | 05:28 pm
I had to write up a quick data processor at work today and I wanted a decent output at the end of execution. The ruby tap method came in handy here.
Tap before you squash 28 Jan 2011 | 08:46 am
Tap is a pretty awesome ruby method I recently discovered. Let’s say I have the following request: I realize something is screwed and I want to print out the sig before sending. Normally I would act...
Tap before you squash 28 Jan 2011 | 03:46 am
Tap is a pretty awesome ruby method I recently discovered. Let’s say I have the following request: post '/api/v1/users/', params.merge(:sig => Authentication.calculate(TestAuthData.secret_access_key,...
RSpec 2, Sinatra and Mongoid example 20 Jan 2011 | 04:39 am
I spent yesterday coding a very abbreviated version of an authentication service that uses Sinatra, Mongoid and RSpec 2. It took more than a couple hours because there are so many outdated code sample...
RSpec 2, Sinatra and Mongoid example 19 Jan 2011 | 11:39 pm
I spent yesterday coding a very abbreviated version of an authentication service that uses Sinatra, Mongoid and RSpec 2. It took more than a couple hours because there are so many outdated code sample...
Rails Authentication with Devise and CanCan part 2 – Restful Resources for Administrators 30 Sep 2010 | 05:26 am
About two months ago I wrote an article on getting started with Devise and CanCan. Since then, I’ve implemented the Devise + CanCan combo on three projects and wrote a couple specs for Ryan Bates to h...