Fernando Perez
2009-Mar-22 18:31 UTC
How does view know about instance vars set in controller?
Hi, I know that the AWDWR says to believe in magic and to not spend Xmas with people asking this question, but really how does it work under the hood? I was looking at the source code of crummy, and it seems that instance_variable_set and instance_variable_get may be part of the answer. Is there some resource on that or do I have to dive into Rails code? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2009-Mar-22 19:38 UTC
Re: How does view know about instance vars set in controller?
On Mar 22, 6:31 pm, Fernando Perez <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > I know that the AWDWR says to believe in magic and to not spend Xmas > with people asking this question, but really how does it work under the > hood? > > I was looking at the source code of crummy, and it seems that > instance_variable_set and instance_variable_get may be part of the > answer. Is there some resource on that or do I have to dive into Rails > code?The method you''re interested in is _copy_ivars_from_controller in ActionView::Base Fred> -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Fernando Perez
2009-Mar-24 16:49 UTC
Re: How does view know about instance vars set in controller?
> The method you''re interested in is _copy_ivars_from_controller in > ActionView::Base > > FredThank you very much Fred. But how can I find about that myself? Is there somewhere a documentation that could walk me through the Rails'' source code from the entry point (let''s say Rack) to the response (returned by Rack to the client)? Following it by hand is a bit tedious, I often lose myself in method calls that call 3 other methods that call 4 other methods. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Greg Donald
2009-Mar-24 18:05 UTC
Re: How does view know about instance vars set in controller?
On Tue, Mar 24, 2009 at 11:49 AM, Fernando Perez <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Is there > somewhere a documentation that could walk me through the Rails'' source > code from the entry point (let''s say Rack) to the response (returned by > Rack to the client)?To what end?> Following it by hand is a bit tedious, I often lose myself in method > calls that call 3 other methods that call 4 other methods.Use the "step" command in the debugger. -- Greg Donald http://destiney.com/ --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Fernando Perez
2009-Mar-24 20:06 UTC
Re: How does view know about instance vars set in controller?
> To what end?[200, {''Content-type'' => ''text/html''}, response] :-D> Use the "step" command in the debugger.Any experience with Unroller? It seems to do what I want. I''ll give a try at the step command too. Thanks, -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Fernando Perez
2009-Mar-25 08:03 UTC
Re: How does view know about instance vars set in controller?
>> Use the "step" command in the debugger. > Any experience with Unroller? It seems to do what I want. I''ll give a > try at the step command too.In put require ''rubygems'', ''ruby-debug'' and then debugger right in script/server, and man there is a lot of stuff to learn. s[tep] is exactly what I was looking for, up to now I was only using n[ext] which didn''t do enough for me. Thanks for the tip ;-) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---