Please read for an updated status on RailsCasts:
Learn more or hide this
For the routes, I use the js-routes gem quite extensively, it has always worked well for me.
I second was Eric has said above.
If something like this can be done in a Rails environment, it gives us enough of a framework to create a nice look and feel.
+1 for Backbone/Rails/Twitter bootstrap - very cool
re: Coffeescript/Backbone/Datatables - you might want to check out Slickback - a plugin that integrates Backbone and Slickgrid.
I'm thinking about using this technique to create a pop up for login. But not too sure how to procede (haven't tried yet, just thinking). I do know I need to send json from session#new function and use js to consume that and add it to the hidden lightbox. That's how I'm thinking about it, can anyone let me know if this sounds right...I'd like to use gon and possibly rabl too. Help appreciated.
"<%=j products_url %>";
products_url wasn't set as a variable anywhere. How did the above code get the url? localhost:3000/products
Why was the "j" necessary?
Thanks for the railscast, Gon looks very promising!
My only fear is that google won't index anything more then 'Loading products...', making this technique unusable for certain projects. Are there any solutions known for this problem?
Looks good but seems to have a conflict with cancan (both current release and 2.0 alpha). Would post a bug report but not really sure which gem is the culprit.
On a brand new rails 3.2.1 app with only cancan and rabl added to Gemfile:
/usr/local/rvm/gems/ruby-1.9.3-p125@***/gems/rabl-0.2.8/lib/rabl/template.rb:66:in `<top (required)>': uninitialized constant ActionView::TemplateHandlers (NameError)
from /usr/local/rvm/gems/ruby-1.9.3-p125@***/gems/rabl-0.2.8/lib/rabl.rb:12:in `register!'
from /usr/local/rvm/gems/ruby-1.9.3-p125@***/gems/rabl-0.2.8/lib/rabl/railtie.rb:6:in `block (2 levels) in <class:Railtie>
Anyone else seeing this?
Yes. I also have this issue. Rails 3.2.1 with rabl.
I am getting this error as well, though without cancan. Same trace to rabl/template.rb:66...
define in your gemfile that you need '0.6.0'. apparently they released a new version and somehow my gemfile thought it had to use 0.2.8. Which clearly wasn't compatible yet with rails 3.2.
for example if you have a string like:
and if you have:
window.myvar = '<%= j "<foo>" %>';
<% end %>
then window.myvar == "<foo>"
the j function really has to replace '<' and '>' with '\u003C' and '\u003E'.
that should be:
window.myvar == "<foo>"
Does gon work with jruby-1.6.5 ? Thanks
travis-ci told me that it works on all rubies, jrubies and rbxes
I'm trying to refresh a kendo chart with new data that uses gon variables as the data......it doesn't refresh the gon variable though with an ajax call! Any suggestions? I looked at gon.watch, but I need to update mutliple variables and it seems to work best with just a single variable and a time interval. I just need to refresh all the gon variables I have on the ajax call.
Does Gon work on production, when asset pipeline is on and js minified?
An if it does, how it works? Does it re-minified applications.js, I thought that application.js was cached through all requests.
Exactly what I was looking for! Thanks.
Does anybody know how to use Gon in helper methods?
I have the same problem of benniemietz, gon variables doesn't refresh after ajax call, I tried with gon.watch, reset and reload without success. Anybody has a suggestion?
var foo = '<%= j @foo.html_safe %>';
var foo = '<foo>';
Which is almost certainly not what you want.
Actually, furthermore you really should be adding a to_s on @foo:
var foo = '<%= j @foo.to_s.html_safe %>';
Because if there's any chance @foo might not be a string, you'll get a NoMethodError trying to call html_safe on it.
I'm gonna go out on a limb here and wager that most Rails devs are not applying these three (count 'em, three) conversions on their values in order to splat them into a script?
How can you actually load in the comments inside of the div?
First sign in through GitHub to post a comment.