I’m failing to see why a member variable in my controller won’t keep
it’s value. Here’s the setup:
editor_controller.rb:
…
def index
display_loops
end
def mytoggle
@show_loops = !@show_loops
redirect_to :action => “index”
end
…
index.rhtml:
<% if @show_loops %> <% link_to "Hide Loops", { :action => "mytoggle" } %> <% else %> <% link_to "Show Loops", { :action => "mytoggle" } %> <% end %>
...
When this HTML is rendered and i click on “Hide Loops”, the
@show_loops variable does get toggled from false to true, but when it
gets redirected back to index, the variable is back to false. Am I
missing something obvious?