I fired up my rails app after a few weeks, only to find it was broken, in that the variable seems to be losing it''s value somewhere between the controller and the view. I''ve broken it down to the absolute simplest test, and here is what I get: THE CONTROLLER (controllers/visits_controller.rb) class VisitsController < ApplicationController def list @test = "test" end end THE VIEW (views/visits/list.rhtml) Testing: <%= @test %></p> THE RESULT (http://logapp/visits/list.rhtml) Testing: EXPECTED REUSULT Testing: test A ''@test.inspect'' returns ''nil''. Any ideas? Thanks. -- Posted via http://www.ruby-forum.com/.
Not sure if you''ve just made a typo... but lose the ".rhtml" off the url. Cheers -h On 7/11/06, Joel <jturnbull@stratacache.com> wrote:> I fired up my rails app after a few weeks, only to find it was broken, > in that the variable seems to be losing it''s value somewhere between the > controller and the view. I''ve broken it down to the absolute simplest > test, and here is what I get: > > THE CONTROLLER (controllers/visits_controller.rb) > class VisitsController < ApplicationController > def list > @test = "test" > end > end > > THE VIEW (views/visits/list.rhtml) > Testing: <%= @test %></p> > > THE RESULT (http://logapp/visits/list.rhtml) > Testing: > > EXPECTED REUSULT > Testing: test > > > A ''@test.inspect'' returns ''nil''. Any ideas? Thanks. > > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Hi -- On Tue, 11 Jul 2006, Joel wrote:> I fired up my rails app after a few weeks, only to find it was broken, > in that the variable seems to be losing it''s value somewhere between the > controller and the view. I''ve broken it down to the absolute simplest > test, and here is what I get: > > THE CONTROLLER (controllers/visits_controller.rb) > class VisitsController < ApplicationController > def list > @test = "test" > end > end > > THE VIEW (views/visits/list.rhtml) > Testing: <%= @test %></p> > > THE RESULT (http://logapp/visits/list.rhtml) > Testing: > > EXPECTED REUSULT > Testing: test > > > A ''@test.inspect'' returns ''nil''. Any ideas? Thanks.Drop ".rhtml" from the URL. David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy http://www.manning.com/black => RUBY FOR RAILS, the Ruby book for Rails developers http://dablog.rubypal.com => D[avid ]A[. ]B[lack''s][ Web]log dblack@wobblini.net => me
dblack@wobblini.net wrote:> Drop ".rhtml" from the URL.Excellent! Can''t believe I missed that. Duh ;-( Best regards, Bill