RailsCasts Pro episodes are now free!

Learn more or hide this

TheCompWiz's Profile

GitHub User: TheCompWiz

Comments by

Avatar

Ok... I think I found a fix for rails 3.1. The trick is to keep from using assets. You need the page to be rendered. This may seem hack-ish... I agree... but it does work. This can probably be better refined in the future.

What you need to do, is add an entry in the routes file before the "resources" for products like so:

match "/products/index.js", :controller => 'products', :action => 'index', :format => :js

and proceed as normal. What this does in essence is get Rails to skip using the brand-new asset manager system... and go back to the old-fashioned rendering setup. This is probably a good thing as the index.js is rendered per-request and won't be concat'd together with the other javascript and not minified.

Avatar

@quatermain ... I ran into the same thing. Apparently, "render" is not available to assets in rails 3.1. I'm still poking around for a solution...