Guaranteed not to work - you're just creating a local_variable in a
completely different scope.
Like i said in a similar thread, a render :update block behaves like a
normal view: instance variable are copied over. If you want controller
instance methods to be available, they need to be helper methods (see
documentation for helper_method)
Like i said in a similar thread, a render :update block behaves like a normal view: instance variable are copied over. If you want controller instance methods to be available, they need to be helper methods (see documentation for helper_method)
That's useful to know.
An alternative is to call controller instance methods from inside
the render block like "controller.meth", or "controller.send(:meth)"
for private methods.
Frederick Cheung wrote:
> Like i said in a similar thread, a render :update block behaves like a
> normal view: instance variable are copied over. If you want controller
> instance methods to be available, they need to be helper methods (see
> documentation for helper_method)
That's useful to know.
Yes, but somewhat unexpected. But
An alternative is to call controller instance methods from inside
the render block like "controller.meth", or "controller.send(:meth)"
for private methods.
Thanks for that. Ruby is the only language I have that used
that supports closures while also allowing methods to be called
without an
explicit object. I expected that 'self' would be bound inside
the closure at the time the closure was defined.