Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

PIVOTAL LABS
Standup 12/19/2007

Interesting Things

  • Rails Bug: composed_of seems to be broken, at least in Rails 1.99. The :mappings parameter states that it can take an array of symbol-pairs, but symbols do not work — only strings work. Example:
    Does not work:
composed_of :name
            :class_name => Name
            :mapping => [
                [:first_name, :first], # :symbol, :symbol does not work!
                [:last_name,  :last]  # :symbol, :symbol does not work!
            ]

Works!

composed_of :name
            :class_name => Name
            :mapping => [
                ['first_name', 'first'], # 'string', 'string' works!
                ['last_name',  'last']  # 'string', 'string' works!
            ]
  • Ruby ain’t Java! A recent Java-convert ran into the following: when calling a private instance method, you must not indicate self.private_method, but instead call private_method. Example:
Class PrivateCaller
    def call_private_here
        puts private_method        #=> works!
        puts self.private_method  #=> self?  uh oh!
    end

    private

    def private_method
        '*** You Called? ***'
    end
end

>> priv = PrivateCaller.new
=> #<privatecaller:0x14ec39c>
>> priv.call_private_here
*** You Called? ***
NoMethodError: private method `private_method' called for #</privatecaller:0x14ec39c><privatecaller:0x14ec39c>
        from (irb):4:in `private_caller'
        from (irb):23
        from :0
</privatecaller:0x14ec39c>

Comments
  1. Tim says:

    Man you don’t even know how long I’ve waited for this since disabling my own Movable Type widget

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *