On 20 Jan 2009, at 22:28, David Law wrote:

>
> I understand that.  I'm not particularly familiar with class << self
> but it seems that everything within its bounds is considered a
> instance method.  In this case would I simply put respond_to?
> (:inherited_with_facebooker)?  Sorry to be bugging you so frequently,
> just trying to understand this as best as I can.  Thank you for all
> your help.

I'd check WhateverClass.method_defined?

Fred

>
>
> David
>
> On Jan 20, 1:51 pm, Frederick Cheung <[email protected]>
> wrote:
>> On 20 Jan 2009, at 21:19, David Law wrote:
>>
>>
>>
>>> Initially I had self.respond_to? but it did not work either which  
>>> lead
>>> me to believe that it might be a class problem instead of an  
>>> instance
>>> one.  Is that what you are referring to?
>>
>> Not really. What I am saying is that SomeClass.respond_to? :foo
>> tells you whether you can do SomeClass.foo, not whether you can do
>> some_instance.foo
>>
>> Fred
>>
>>> On Jan 20, 12:52 pm, Frederick Cheung <[email protected]>
>>> wrote:
>>>> On 20 Jan 2009, at 20:48, David Law wrote:
>>
>>>>> Here you can see the method inherited has been aliased to
>>>>> inherited_with_facebooker and inherited_without_facebooker has  
>>>>> been
>>>>> aliased to inherited.  However, when the method is called
>>>>> inherited_without_facebooker goes into an endless recursive call
>>>>> which
>>>>> results in a stack level too deep error.  I tried to prevent
>>>>> alias_method_chain from being called twice (which is what I  
>>>>> suspect
>>>>> the problem being) by checking if inherited_with_facebooker  
>>>>> already
>>>>> exists.  It has not seemed to fix the problem.  Does anyone else
>>>>> have
>>>>> a possible solution I may try.  Thanks again!
>>
>>>> You're in the right mindset but you haven't got you're check quite
>>>> right. You ask whether the object ActionController::Base (ie the
>>>> class) responds to that method and it doesn't so that will always
>>>> return false. What you want is whether instances of that class
>>>> respond_to your method (so this is the same as
>>>> String.respond_to? :strip returning false, "".respond_to? :strip
>>>> returns true)
>>
>>>> Fred
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to