Well, as Colin says, there is nothing about the name of a method or
view that would muck with an instance variable working, but there
could also be something weird about TestController (that it *may* be
reserved, but i doubt it)...
Are you getting an error/stack trace?
Your routes could be an issue but you'd be getting an obvious error
(assuming you're in dev mode) saying something to the effect of "No
route matches "/test/foo" with {:method=>:get}"
Try posting some of your code and seeing if you get some clearer
answers. :)
Cheers!
On May 31, 1:37 am, Colin Law <[email protected]> wrote:
> As long as the name of the view and the method match it should work.
> There is nothing special about the default methods in this respect.
> Post a bit more code that exhibits the problem. Presumably the view
> is called views/test/foo.html.erb. Unless there is something special
> about a controller called 'test' that is.
>
> Colin
>
> 2009/5/31 zambezi <[email protected]>:
>
>
>
> > I'm a bit flummoxed by something and hoping someone can offer an
> > explanation.
>
> > If I create a controller (test) with a RESTfully named method and a
> > view (.../test/index), the value of the instance variable passes to
> > the view.
>
> > class TestController < ApplicationController
> > def index
> > �...@variable = 'Pass to a view'
> > end
> > end
> > -------------
>
> > If I rename the view to (.../test/foo) or some other non-RESTful name
> > and appropriately alter the controller method, the value of the
> > instance variable does not pass.
>
> > class TestController < ApplicationController
> > def foo
> > �...@variable = 'Pass to a view'
> > end
> > end
> > ---------------
>
> > A half dozen inprint and online books seem to dispute my personla
> > experience and suggest that the name of the method and view should be
> > irrelevant. So does anybody have a suggestion as to what is going
> > on? Is my routes.rb file where I need to be looking?
>
> > Thanks much, Bill
--~--~---------~--~----~------------~-------~--~----~
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 this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---