Silverlight on Rails
If someone visited /foo, it would show them a link saying “Show time”. The line that makes all the difference is client :time, so ...
- Without client :time
- time would be run on the server
- With client :time
- a copy of this controller would be sent to the client when someone visits /foo.
- link_to_remote call would use Silverlight to call the time action on the client
The beauty of this is with one line you’ve decided to run a bunch of server-side code on the client, and it just happens for you.This is better than sliced bread!
This pattern of pushing server-side logic to the client is the approach big sites like Twitter and GMail have taken, and it’s really the best way to make web applications feel more responsive ... it’s the whole RIA thing and why Silverlight is cool. Twitter went through a ton of growing pain getting their app to scale well, and I can bet much of it was attributed to “what should we do on the client, and what should we do on the server” (and what should be cached and what should be stored in a database, but that's a different topic altogether).
I’d like to live in a world where you can write your entire app in Ruby, and not have to throw away a ton of code to get some of it running on the client. That’s what I’m trying to accomplish with this project.You're right, this is better than slided bread!
Update: By the way, I got this example working today! Without "client :time" it works as usual, making an AJAX request when clicking on the "Show time" link. But when you add "client :time", clicking on "Show time" simply runs the code on the client! Awesome!
I'm probably going to put this up on RubyForge ... just not sure whether I should make my own project or stick it in the IronRuby? Regardless, code is coming =)