Sí, puedes hacer esto. Y si es posible que, probablemente, hacer una nula una asignación de forma que se mostrará en sus opiniones de una manera agradable
decir (esto siguiente ejemplo tiene el 'my_controller' como el diseño)
class my_controller < application_controller
def my_parent_method
@text_from_my_child_method = child_method
end
def child_method
return 'hello from child_method'
render :layout => false #here we are making the child_method layout false so that it #will not effect the parent method
end
end
y en su 'my_parent_method.rhtml' (ver) puede utilizar la variable
<%= @text_from_my_child_method %> and it should print 'hello from child_method'
esperanza esto ayuda
aplausos, sameera
Si tiene que hacer esto, recuerde poner el método llamado detrás de 'private', a menos que sea una ruta disponible públicamente –