0

ローカル Webrick サーバーから実サーバーにサイトをデプロイしました。

http://92.51.243.6/

自分でデプロイできてうれしかったのですが、ほとんどのリンクが機能しないことに気づき、それはすぐに消えてしまいました。(私は Facebook の問題について知っています。それは本当に私が今心配しているリンクです) 「申し訳ありませんが、問題が発生しました」

コードでリンクを作成しました:

 <div id = "menu">
      <ul id = "home_page_links">
        <li><%= link_to "Home",about_us_path, :remote => true %></li>
        <li><%= link_to "About Us",about_us_path, :remote => true  %></li>
        <li><%= link_to "FAQ", faq_path, :remote => true  %></li>
        <li><%= link_to "Contact Us", contact_us_path, :remote => true  %></li>
      </ul>
    </div>

WEBrick のローカル モードでは、すべてのリンクが正常に機能します。私の運用ログには、次のような多くのメッセージが表示されます。

Started GET "/contact_us" for 77.24.238.174 at Thu May 30 00:11:08 +0100 2013
Processing by StaticPagesController#contact_us as */*
  Rendered static_pages/contact_us.html.erb within layouts/application (0.0ms)
Completed 500 Internal Server Error in 4ms

ActionView::Template::Error (ie.css isn't precompiled):
    12:   <%= javascript_include_tag "application" %>
    13:   <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    14:   <!--[if lt IE 9]>
    15:     <%= stylesheet_link_tag 'ie', :media => 'all' %>
    16:     <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    17:   <![endif]-->
    18: </head>
  app/views/layouts/application.html.erb:15:in `_app_views_layouts_application_html_erb__922519344_37417300'

そして、ここに私のroutes.rbファイルがあります:

QuestionnaireSite::Application.routes.draw do

  get "about_us", :to => "static_pages#about_us"
  get "contact_us", :to => "static_pages#contact_us"
  get "faq", :to => "static_pages#faq"
  get "competition_terms", :to => "static_pages#competition_terms"
  get "t_and_c", :to => "static_pages#terms_and_conditions"
  # get "user", :to => @user(current_user)
  get "render_index_review", :to => "reviews#render_index"

  devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }

  devise_scope :user do
    delete "sign_out", :to => "devise/sessions#destroy"
    get "login", :to => "devise/sessions#new"
  end

  devise_for :admins, :path => "admin", :controllers => { :sessions => "admin/sessions" }

  get "home/index"
  get "home/map", :as  => :map
  post "home/update_address", :as  => :update_address
  match "canvas" => "canvas#index"

  match "/contacts/:importer/callback" => "email_invites#contacts_callback", :as => :contacts_callback
  match "/contacts/failure" => "email_invites#contacts_callback_failure", :as => :contacts_callback_failure
  mount Resque::Server, :at => "/resque"

  get "find" => 'search#index', :as => :find

  resources :search do
    collection do
      match :change_range
    end
  end

  resources :reviews do
    member do
      get :repost, :reject
    end
  end
  resources :users do
    member do
      get :following_followers, :address_toggle
    end
  end
  resources :friend_relations, :only => [:create, :destroy]
  resources :email_invites do
    collection do
      get :confirm
      post :invitation_form
      post :outlook_import
    end
  end

  root :to => "home#index"

  namespace :admin do
    resource :profile, :only => [:edit, :update]

    resources :users
    resources :categories
    resources :reviews

    root :to => "users#index"
  end

そして、ajax を実行する scripts.js ファイル:

//I want to load content into the '.page-content' class, with ajax

var ajax_loaded = (function(response) {        

  $(".page-content")

  .html($(response).filter(".page-content"));       

  $(".page-content .ajax").on("click",ajax_load); 



   });


//the function below is called by links that are described 
//with the class 'ajax', or are in the div 'menu' 

var history = [];                 

// var current_url_method;               

var ajax_load = (function(e) {  


  //console.log('load ajax on clicks. This always works.');         
  e.preventDefault();               


  history.push(this);               
  var url =$(this).attr("href");          
  var method = $(this).attr("data-method");   

  // if (current_url_method != url + method) {   
  //   console.log('You got to the url + method part. But sometimes I dont get this far.'); 
  //   current_url_method = url + method;      

  $.ajax({                  
    url: url,               
    type: method,  
    // async: false,                       
    success: ajax_loaded

    // $('html, body').animate({ scrollTop: 0 }, 0);       
  });
   // }

 });


//monitor for clicks from menu div, or with
//the ajax class, or the 'submit button'.
//why the trigger?

$(document).on("ready", function(){
$("#menu a").on("click",ajax_load);
$(".ajax").on("click",ajax_load);
$("#menu a.main").trigger("click");


});

どんな助けでも感謝します、ありがとう。

4

3 に答える 3

1

アプリを本番環境にデプロイしていますか?

エラーは次のとおりです: ActionView::Template::Error (つまり、.css はプリコンパイルされていません):

これは、すべてのアセットをプリコンパイルする必要があることを意味します。このコマンドを実行して、サーバーを再起動してください。

bundle install
bundle exec rake assets:clean
bundle exec rake assets:precompile

さらに脱線するには、レール展開ガイドに記載されている基本的な手順に従ってください。 http://guides.rubyonrails.org/asset_pipeline.html#in-production

于 2013-05-30T11:28:40.843 に答える