3

I'd created my first web app using Ruby on Rails. And now, I want to make it offline.

How-to create HTML5 offline Cache manifest file in Rails 3.2 app?

I read some Q&A and articles. They seems outdated. (e.g. Rack-offline?)

.note: e.g. Rack-Offline will output home.js rather than home-234201233453.js

To make use of asset pipeline, I don't want to change settings if possible. (Most articles suggested to disable pre-compile) :-/

Is there any suggestion and tips? (create controller? erb? etc.)

p.s. I'm newbie in development (learn for 1 month only). I understand the html5 manifest mechanism but I'm not sure how to create it in rails

Edditoria
  • 199
  • 1
  • 15

2 Answers2

2

Rack-offline has been updated to work with the asset pipeline in Rails 3.1+. Unfortunately, the maintainer has not bumped the gem version, so simply installing the rack-offline gem won't work for you. In your Gemfile, specify the git repo of the most recent version and you should be good:

gem 'rack-offline', :git => 'https://github.com/wycats/rack-offline.git' 
Jason L
  • 133
  • 3
  • I am using rails 3.2.0 and your solution is not working for me. Generated manifest: CACHE MANIFEST # ecaf43e5a97fb879f9d7fae7de405712edffa707b218e82b1d833d113c688b9d 422.html 404.html 500.html NETWORK: * – RAJ Jul 19 '12 at 11:10
1

The gem hasn't been updated, but there is a fork that has one commit that enables Rails4 support:

https://github.com/pascalw/rack-offline/tree/rails4-support

gem 'rack-offline', :github => 'pascalw/rack-offline'

geoffharcourt
  • 320
  • 3
  • 16
  • Yeah I think this is what I have been looking for.I am using rails 4.1.3 and it has been a problem integrating this. I the fork correctly documented because I am seeing it alike with original gem? Thanks – ben Oct 09 '14 at 09:34