In rhtml, you have access to controller. I am trying to set an instance
var
in my controller, then retrieve it in my form display. I know I could
do
this through one of the hashes I have access to, but I’m trying to
understand why I can’t do it this way.
No matter what, when I try to output from my rhtml either
<%= controller.whynot || ‘Unknown’ %> or <%= controller.othermessage ||
‘Unknown’ %> I don’t get the values I’m setting. Here’s some of the
ways I
try:
class ApplicationController < ActionController::Base
attr_accessor :othermessage
def whynot=(msg)
@msg = msg
end
def whynot
@msg
end
class AgentsController < ApplicationController
def show
othermessage = ‘show set’
whynot=‘jim’
@agent = Agent.find(params[:id])
end