When exporting my data to Excel, I prompt the user to select his export template.

Each export template **should be a separate (ruby) file** that contains several parameters.

I tried to "require" my file after selects it from a drop-down list but the variables that the ruby file contains are not accessible.

**What is the best solution to include a ruby file at runtime, depending on the previous user's choice ?** 

The goal is to include different set of parameters at runtime

My code :

```
Class ExportController < ApplicationController
...
def step3
    filepath = params[:template][:filepath]
    if File.exists?(file=File.join(Rails.root, filepath))
        logger.debug ("-----------> File FOUND : "+file.to_s)    
                     # This gives:  File FOUND : D:/Rails/test1/lib/export/test2.rb
        require file
    else
        logger.debug ("-----------> File not found !!")
    end

end

```

File test2.rb :

```
@test = "Hello world"

```

In the view :

```
<%= @test.to_s %>

```

gives nothing... :-(