Hi there, I'm trying to write an action generator for my Rails apps (probably the most basic form of metaprogramming you can get. My question is, how do I assign an instance variable that is available in views? To me, the code would look like this:
ApplicationController < ActionController::Base
def generate_custom_action
define_method("my_custom_action") do
#...some code...
instance_variable_set("@variable_name", my_value)
# OR
@variable_name = 'aoeu'
end
end
end
But that doesn't seem to work. That is, the varable "@variable_name" is 'nil' in the views. Any idea how to expose this to the view?