Because you are invoking another ruby interpreter it won't share 
anything with your original process.

Can you simply pass the session[:telefono_rem] value to WWW.rb as a 
commandline arg or read it from stdin? Or if you want the whole session 
you could use Marshal to serialise it (depends what session contains). 
This is probably the fastest and easiest way to achieve what you appear 
to be after without changing very much at all.

Alternatively you could load the code from WWW.rb and run it directly, 
or go to town and make WWW.rb a socket based service for your controller 
to connect to and pass information via a user defined protocol.

If it is a local filesystem WWW.rb could use inotify (*nix) to watch a 
file for new entries that your controller writes into. You could spin up 
a redis or some such database and use that for IPC. You could use a 
messaging service like AMQP, or in *nix land a named pipe. There are a 
lot of ways to pass data between processes. It depends on what needs to 
be achieved and why you are doing it/ how fast it needs to be.

I think there is quite a bit of code in the context that is not shown, 
so it is hard to gauge whether I've correclty interpreted your intention 
or not.

Sam


On 19/07/11 10:19, art tav wrote:
> Hi, I was attempting to send a variable from a controller to another
> ruby file that I have in the root of my application. The thing is that I
> can't send the value in any way.
>
> I tryied using sessons, instance variables and I only get nils.
>
> Someone know how to do this?
>
>      session[:telefono_rem] = nil
>      @envio = Envio.find params[:id]
>      if @envio.telefono_remitente.nil?
>          session[:telefono_rem] = '00000000'
>      else
>          session[:telefono_rem] = @envio.telefono_remitente
>      end
>      system("ruby " + PPAL + "WWW.rb")
> ===========================================================
> WWW.rb
>
> File.open(R, "a") do |f|
>            f.puts "( WWW" + number.to_s
>            f.puts "|||||||||||"
>            f.puts "|||||: " + session[:telefono_rem].to_s
>     end#open
>
> With this code it does't print the last line.
>