"Once τ is widely accepted in these communities, we might add it..."
But also:
"...if it were just up to me, I'd add it just to show support. It's a rather tiny and harmless addition."
See the ticket here.
"Once τ is widely accepted in these communities, we might add it..."
"...if it were just up to me, I'd add it just to show support. It's a rather tiny and harmless addition."
I think I've needed and implemented this twice now, so let's make a post about it.
The problem occurs when you are using f.fields_for and nested forms, as per these railscasts, and the nested objects are using STI.
(Will leave a more detailed explanation for future posts).
Update 1: Even though this works as described, I don't think it solves my problem. Will post again if I figure it out...
Update 2: Found this which is I think what I was using last time I had this problem... :S
sudo gem install beginning_of_fortnight
I still don't entirely understand the syntax for accessing the singleton class, but I have found a use for it. :) The goal is to be able to make an object include a mixin on the fly.
If you do self.class.send(:include,module_name) instead of using the singleton class then the change affects every instance, not just the one you intended.
So it seems to work pretty well. Ruby is all like "sure buddy, have some rope, take as much as you need". :)
I should say that this technique was designed to be a quick fix to let us work around some legacy code that really should be refactored and fixed properly. I'm not saying this is a sensible design pattern, but it is cool that ruby can do it.
Here is a good explanation of singleton classes in ruby.
>> (Date.today + 1.week) - Date.today => Rational(7, 1) >> (Time.now + 1.week) - Time.now => 604799.999613 >> (Time.now + 1.week) - Time.now => 604799.999532 >> 7.days.to_i => 604800
Did you ever wish your code looked more like your haml?
Did you ever wonder what ruby would be like with python style significant whitespace?
Without further ado, I present hamrbl.rb
Surprisingly the syntax highlighting works fine in vim and github. :)
Ps, it's pronounced "hammerable"
Disclaimer: This is for amusement purposes only. It is almost certainly a terrible misuse of Haml :).