[Rails] Re: What is @controller instance variable?

2010-08-09 Thread Jim Burgess
> It not that @controller contains a reference to you controller - > it is an actual instance of it. OK, I phrased that badly. > And 'prepending a method call' sounds like you think there is some > magic going on - there isn't - methods are always called on a certain > object (omitting the objec

[Rails] Re: What is @controller instance variable?

2010-08-09 Thread Frederick Cheung
On Aug 9, 9:08 pm, Jim Burgess wrote: > Hi, > > Thanks for all of the replies. > That has really made things a lot clearer for me. > > So, to summarize: > > 'url_for' is a method defined in ActionController::Base. > > @controller is an instance variable initiated by > ActionController::TestCase co

[Rails] Re: What is @controller instance variable?

2010-08-09 Thread Jim Burgess
Hi, Thanks for all of the replies. That has really made things a lot clearer for me. So, to summarize: 'url_for' is a method defined in ActionController::Base. @controller is an instance variable initiated by ActionController::TestCase containing a reference to my controller (PagesController)

[Rails] Re: What is @controller instance variable?

2010-08-09 Thread Frederick Cheung
On Aug 9, 8:14 pm, Jim Burgess wrote: > assert_select "a[href=?]", @controller.url_for(:action => :new, > :only_path => true), :text => 'Neue Seite' > > How is he able to reference a method defined in another class, simply by > prefixing the method call with '@controller' > > Could someone expl