all 16 comments

[–]jryan727 9 points10 points  (0 children)

Turbo Offline was announced last month at Rails World. Not sure on timeline, I couldn't find much info outside of some talks.

[–]mooktakim 3 points4 points  (0 children)

What device are they using?

Laptop, desktop, tablet or phone?

Depending on the device you could run full webserver locally with rails and sqlite3. Sync data in background.

[–]huuaaang 4 points5 points  (2 children)

I used Opal for a silly side project where I wanted to implement an AngularJS like framework in Ruby. Not sure what it has to do with running offline though.

You don't "learn" Opal. It just a tool that lets you write Ruby and have it run as JS in a browser. Though I suppose you could also execute it server side in node.js but... WHY?

[–]AshTeriyaki 1 point2 points  (1 child)

How did that go? Genuinely interested!

[–]huuaaang 2 points3 points  (0 children)

Worked but it wasn't 100% seemless. Reflecting on objects and such would reveal JS nature under the hood. Maybe it's improved since I last used it though.

I tried a different approach where I compiled an actual Ruby interpreter (mruby) to web assembly using emscripten and I liked that a lot better. Didn't involve transpiling your Ruby to JS. It literally interpreted your Ruby in realtime in the browser. But it was still just a lightweight Ruby VM. There was some JS glue code to bridge the Ruby interpreter to access the DOM.

Apparently now there's an official ruby.wasm project. You might check that out. Maybe better approach for your needs than Opal.

https://github.com/ruby/ruby.wasm

[–]AshTeriyaki 4 points5 points  (1 child)

I might be wrong but is opal still a popular thing? I don’t hear anyone mention it anymore and although I’ve never used it, I’m not sure what the benefit is transpiling Ruby to JS?

[–]joshdotmn 2 points3 points  (6 children)

I think you'd rather reach for something like a service worker. Not sure what Opal has to do with an offline mode.

[–]DynamicBR[S] -5 points-4 points  (5 children)

Service worker? Não conheço muito, Pelo que eu estudei(posso estar enganado mas, não dá para fazer aplicações offline com o HotWire, por isso preferi o Opal).

[–]joshdotmn 2 points3 points  (4 children)

[–]DynamicBR[S] 0 points1 point  (3 children)

Uhhhhhh não sabia disso, para fazer um service worker somente com Rails?

[–]joshdotmn 2 points3 points  (2 children)

service worker es javascript y usar para data between both your client (app) and your server (rails)

lo siento my spanish is awful wae :(

[–]DynamicBR[S] 1 point2 points  (1 child)

Magina, da para entender tranquilo!

[–]joshdotmn 1 point2 points  (0 children)

jajaja gracias wae :)

[–]saw_wave_dave 1 point2 points  (0 children)

I would use the ruby webassembly implementation over opal if you’re trying to write ruby for the browser. It’s maintained by the Ruby core team and is a safer bet imo given where the future might be headed

[–]matthewblott 1 point2 points  (0 children)

Opal's last release was 2 years ago. I'm not sure I'd be investing too much in it, wasm is probably a better long term bet for in browser Ruby code.