Open kirqe opened 1 year ago
What is the alternative of ctx[key] = value that was available in rubyracer?
ctx[key] = value
In rubyracer, the following block would return hi 1
hi 1
ctx = MiniRacer::Context.new person = Person.first ctx[:person] = person ctx.eval("'hi' + person.id")
I have tried the following things:
ctx.attach("person", proc{ person }) [8] pry(#<...>)> ctx.eval("person") => #<MiniRacer::JavaScriptFunction:0x0000000123b1d220> [9] pry(#<...>)> ctx.eval("person.name") => "" [10] pry(#<...>)> ctx.eval("person.id") => nil [11] pry(#<...>)> ctx.eval("person()") => "Undefined Conversion"
What is the correct way to do what I've described above with mini_racer?
Thank you!
edit Not exactly what I need but this kinda works(not for relations though eg person().address)
person().address
ctx.attach("person", proc{person.serializable_hash}) ctx.eval("person().id")
What is the alternative of
ctx[key] = value
that was available in rubyracer?In rubyracer, the following block would return
hi 1
I have tried the following things:
What is the correct way to do what I've described above with mini_racer?
Thank you!
edit Not exactly what I need but this kinda works(not for relations though eg
person().address
)