Forum: Ruby on Rails self.inspect in helper file

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
661ae6e97d0e16c2af2aaf7d197e8387?d=identicon&s=25 Sijo k g (sijo)
on 2009-01-01 09:32
Hi
    I just noticed this When i tried

puts self.inspect  just in the module ApplicationHelper  gives
ApplicationHelper

And if i place the above puts statement in any def in the helper module,
then it prints like

#<ActionView::Base:0xb67a6be0 @first_render="home/index",
@content_for_layout="<div class=\"ho........etc

            I did not understand the difference .Could you please
explain this?

Thanks in advance
Sijo
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-01-01 10:05
(Received via mailing list)
On 1 Jan 2009, at 08:32, Sijo Kg <rails-mailing-list@andreas-s.net>
wrote:

>
> #<ActionView::Base:0xb67a6be0 @first_render="home/index",
> @content_for_layout="<div class=\"ho........etc
>
>            I did not understand the difference .Could you please
> explain this?
>

Because those two statements run at very different times. Once when
the module is being defined (self is the module) the second runs when
one of the instance methods runs in which case self is the object in
question.

Fred
661ae6e97d0e16c2af2aaf7d197e8387?d=identicon&s=25 Sijo k g (sijo)
on 2009-01-01 12:02
Hi
     Thanks for your reply
Sijo
This topic is locked and can not be replied to.