Real-time Web Apps with Volt in Ruby

Originally published at: http://www.sitepoint.com/real-time-web-apps-volt-ruby/
volt

Volt is a slick, new Ruby web framework that aims to blur the line between client and server code. The basic idea behind the framework is that you can write your client-side code (which is usually Javascript) in Ruby using Opal, a Ruby runtime within Javascript. In addition, Volt provides some nice ways to relay data between the client-side and the server-side. If you’ve used Meteor before, Volt is a very similar idea, but there are many portions of Meteor which Volt doesn’t have. I think Volt has some real potential. As web apps become more and more client-side heavy, it is a pain to have to switch mental context between Javascript and Ruby. It’s even more of a pain to figure out how to flow simple pieces of data between the client and server. Volt can help you get there quickly.


Continue reading this article on SitePoint

Thanks for the article on volt :slight_smile: One thing, in your demo code, when you change to using store, you need to either reference store directly in the views:

store._bookmarks

or you need to set the controllers model to be :store

class MainController < Volt::ModelController
  model :store

  ...
end

Also, Volt has realtime updates like Meteor. We do things a bit different implementation, but the end result is the same, updates are pushed to clients and the DOM updates when the data changes. Let me know if there’s anything I can help clarify.

Again, thanks for the great article!

Ryan (volt framework creator)

1 Like

Hi Ryan,

Thanks for the compliments. I had the controller model setting in my code but didn’t include it in the article - I’ll get it changed right away.

The point I was making about Meteor was just pointing out the differing implementation; as far as I know, Volt does not have a small implementation of MongoDB running in the browser. I can reword it to make that more clear.

Thanks,

Dhaivat

Volt looks very interesting. I have held off building anything with it so far, but I’m definitely going to follow this tutorial and go from there. Great article.

One funny thing I get - when I enter www.google.com for the url, than the actual url I get in the bookmarks list is localhost:3000/www.google.com. Any idea as to why this happens?

@estebanrules Thanks!

@alpop If you add the “http://” at the beginning of the url string, that should enter it correctly. Otherwise, it is rendered as a local, relative path which is why it opens as “localhost:3000/www.google.com/”.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.