Re: [Rails] Re: Please help. I would like to assign a java variable to a ruby instance variable.

2012-03-06 Thread Colin Law
On 6 March 2012 15:01, Alpha Blue wrote: > Here's an example for you: > > class Dynamic >  def initialize(variable,value) >    @var,@val = variable,value >  end > end > > test = Dynamic.new('somevar', '') > test.instance_variable_set(:@brand, 'You see my value') > > x = test.instance_variable_get(

[Rails] Re: Please help. I would like to assign a java variable to a ruby instance variable.

2012-03-06 Thread Alpha Blue
Here's an example for you: class Dynamic def initialize(variable,value) @var,@val = variable,value end end test = Dynamic.new('somevar', '') test.instance_variable_set(:@brand, 'You see my value') x = test.instance_variable_get(:@brand) p x -- Posted via http://www.ruby-forum.com/. -

[Rails] Re: Please help. I would like to assign a java variable to a ruby instance variable.

2012-03-06 Thread Alpha Blue
Sorry about that - I corrected it above. You can set your own instance variables using: self.instance_variable_set(:@var_name, value) Which will allow you to create dynamic variables. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Go

[Rails] Re: Please help. I would like to assign a java variable to a ruby instance variable.

2012-03-06 Thread Alpha Blue
gon.user = User.first gon.user.instance_variable_set(:@var_name, value) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. T

Re: [Rails] Re: Please help. I would like to assign a java variable to a ruby instance variable.

2012-03-05 Thread Abram
@ALPHA BLUE, Are you sure, it seems gon only allows for importing ruby/rails variables into Javascript, and not the other way around? Thanks again On Sat, Mar 3, 2012 at 11:43 AM, Abram wrote: > Thanks guys > > > On Fri, Mar 2, 2012 at 9:50 AM, Alpha Blue wrote: > >> You can do that with the

Re: [Rails] Re: Please help. I would like to assign a java variable to a ruby instance variable.

2012-03-02 Thread Abram
Thanks guys On Fri, Mar 2, 2012 at 9:50 AM, Alpha Blue wrote: > You can do that with the Gon gem. > > https://github.com/gazay/gon > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > T

[Rails] Re: Please help. I would like to assign a java variable to a ruby instance variable.

2012-03-01 Thread Alpha Blue
You can do that with the Gon gem. https://github.com/gazay/gon -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubsc