Passing params

I am having a problem passing a variable from a test_helper.rb to the
controller test. I am parsing a string in the helper file and I am
creating an array name @choose1. I can access the elements in @choose1
in the view but I can’t in the controller. I thought global variables
such as @choose1 could be accessed anywhere within the the test
controller/view/helper. Does anyone know how this can be done?

Any ideas?

@choose1 is not a global variable, it is an instance variable. Global
variables start with $.

I can’t really work out what you are trying to do though- could you
post the helper method?

On Dec 16, 10:58 am, Hickman H. <rails-mailing-l…@andreas-

Thanks for the feedback though, I appreciate it

Problem solved… Initalize the variable in the application_controller
and set the contents in the test_helper then you can access it anywhere
you want

Dont know if its the best fix but it works

I’m confused. Are you trying to write a test? The only inputs to a
controller action are the params, the session, and the database. No
variables of any kind, global or not, are retained between controller
actions, so why would you want to set one?

could you post the helper method?

The helper method is extremely long. All I am trying to do is create an
array inside test_helper and be able to access it inside the
test_controller. I tried using $ and it doesn’t work.

kevin cline wrote:

I’m confused. Are you trying to write a test? The only inputs to a
controller action are the params, the session, and the database. No
variables of any kind, global or not, are retained between controller
actions, so why would you want to set one?

No im not trying to write a test and what I thought was working wasn’t
haha. Its called test_controller because I am converting a written test
to a computerized test. I am trying to make it so an administrator can
type a simple string into a form and design a test by using simple tags
that anyone would understand. Like a wiki but simpler. The clients I
am doing it for barely know how to use a computer. I am parsing the
string that they stored in the database to translate it into html and
displaying a formatted page. The parser was a helper method and I am
using AJAX to change parts of the page once it is loaded based on user
input. It is a test for 3rd and 4th graders. I needed to be able to
access an array that was initialized in test_helper from the
test_controller. I thought it was working at first but what I had to
end up doing was storing the array in a session variable to be able to
access it in both places. Not sure if it is the best solution but it
will work for now until I find a better one. Does that make sense?