The @test
variable I have is getting evaluated before I want it to. Here's what I intend: I have a button (link right now) with a variable shown next to it. The value should say "blank" when the page is initially loaded. When I click that button, the page should refresh and the variable should be changed to something else because the button calls a helper method.
Here's what I have in home.html.erb:
<%= link_to 'Do stuff', my_helper_method(), :method => :get %>
<%= @test %>
Here's what I have in my_proj_helper.rb (helper method):
module MyProjHelper
def my_helper_method()
@test = "changed"
end
end
In my_proj_controller.rb (controller), I have this:
class My_Proj_Controller < ApplicationController
def home
@test = "blank"
end
end
I must not be doing things correctly. What needs to change?