thanks for response

On Sep 6, 5:32 am, Frederick Cheung <[email protected]>
wrote:
> On Thursday, September 6, 2012 2:39:00 AM UTC+1, John Merlino wrote:
>
> > module ActionView
> >   module Helpers
> >     module FormHelper
> >       def form_for(foo, bar)
> >          instantiate_builder(foo, bar)
> >       end
> >       def instantiate_builder(foo,bar)
> >         self
> >       end
> >     end
> >   end
> > end
>
> > "self" in instantiate_builder refers to
> > ActionView::Helpers::FormHelper. self it will have access to methods
> > in ActionView::Helpers (its parent module), correct?
>
> Not necessarily.
>
> if you do
> class Foo
>   include ActionView::Helpers::FormHelper
> end
>
> then
> f = Foo.new
> f.instantiate_builder
>
> then self in instantiate_builder is f. Whether or not other modules in
> ActionView::Helpers have been included in Foo is not guaranteed (in the
> particular case of view helpers in views then all the other submodules
> of ActionView::Helpers would normally have been included)
>
> 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 https://groups.google.com/groups/opt_out.


Reply via email to