Recently i have posted this issue, so then i tried another way to cache the 
javascript and css, things like

This is routes.rb

offline = Rack::Offline.configure  do 

cache ActionController::Base.helpers.asset_path("application.css")
cache ActionController::Base.helpers.asset_path("application.js")
cache ActionController::Base.helpers.asset_path("jquery.offline.js")
cache ActionController::Base.helpers.asset_path("jquery.tmpl.min.js")
cache ActionController::Base.helpers.asset_path("json.js")

network "/"end
get "/application.manifest" => offline

This is the application.html.erb

<!DOCTYPE html><html 
manifest="/application.manifest"><head><title>OfflineTest</title><%= 
stylesheet_link_tag    'application', media: 'all' %><%= javascript_include_tag 
'application' %><%= csrf_meta_tags %></head><body>
<%= yield %>
</body></html>

This is index.html.erb

Listing
<%= form_for Item.new do |f| %><p><%= f.text_field :name %><%= f.submit "Add" 
%></p><% end %>
<script type="text/html" id="item_template"><li>${name}</li></script><ol 
id="items"><li><em>Loading items...</em></li></ol>

This is application.js

//= require jquery//= require jquery_ujs//= require jquery.tmpl.min//= require 
jquery.offline//= require json//= require_tree .

$(document).ready(function(){if ($.support.localStorage) {
$(window.applicationCache).bind("error", function() {
  console.log("There was an error when loading the cache manifest.");});if 
(!localStorage["pendingItems"]) {
  localStorage["pendingItems"] = JSON.stringify([]);}
$.retrieveJSON("/items.json", function(data) {
  var pendingItems = $.parseJSON(localStorage["pendingItems"]);
  $("#items").html($("#item_template").tmpl(data.concat(pendingItems)));});
} else {
alert("Try a different browser.");}});

and added the gem

gem "rack-offline"

after this when i go for the application.manifest , it seems like

CACHE MANIFEST# 
1ad140903542ef1549ddf41cb57e9105786a8b344d7fab9278323e9402e61d14/assets/application.css/assets/application.js/assets/jquery.offline.js/assets/jquery.tmpl.min.js/assets/json.js

NETWORK: /

So the problem coming here like, when i stop the server and check, its not 
loading the JS and CSS files, that means not loading the data in view, but 
its working with online, actually i have tried the same way in rails 4.0.2 
and ruby 2.0.0 that worked. but when i comes to rails 4.1.6 and ruby 2.1.2 
its not working with the offline mode. is there any issues with my 
configuration and all these?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/4812a05e-b212-4adb-a7b7-ac4f79ab8f55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to