3

Rails3.2.8でRailsアプリを実行しています。

モデルは、サーバーを再起動した場合にのみ更新されます。モデルに加えられた変更は、サーバーが再起動されるまで表示されません。

開発中ですが、キャッシュクラスがオフになっています。

他の誰かがこの問題を抱えていますか、私は本当にいくつかの助けをいただければ幸いです。ありがとう。

rvm、ruby、およびgemsetを再インストールしました。

私はそれを修正するために私が考えることができるすべてを試みました。ご覧いただきありがとうございます。

編集:以下に設定の詳細を追加しました...

development.rb

XXXXX::Application.configure do
  config.cache_classes = false
  config.whiny_nils = true
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.perform_deliveries = true
  config.action_mailer.delivery_method = :sendmail
  config.active_support.deprecation = :log
  config.action_dispatch.best_standards_support = :builtin
  config.active_record.mass_assignment_sanitizer = :strict
  config.active_record.auto_explain_threshold_in_seconds = 0.5
  config.assets.compress = false
  config.assets.debug = true
  config.action_mailer.default_url_options = { :host => 'yyyy.xxxx.net' }

  #this is an attempt to fix the issues, didn't work
  config.to_prepare do
    ['algorithm', 'key_dates', 'roles', 'status'].each do | file_name |
      require "#{Rails.root}/app/models/user/#{file_name}.rb"
    end
  end

end

私のユーザーモデルには、次のようなモジュールが含まれています。

class User < ActiveRecord::Base
  include Status, Roles, KeyDates, Algorithm
  #.....
end

モジュールはこのように定義されています

module User::Status

  def self.included(base)
    base.class_eval do
      extend ClassMethods
      include InstanceMethods
    end
  end
  #.....
end

Application.rb

require File.expand_path('../boot', __FILE__)

require 'csv'
require 'rails/all'

if defined?(Bundler)
  Bundler.require(*Rails.groups(:assets => %w(development test)))
end
module XXXXX
  class Application < Rails::Application
    config.encoding = "utf-8"
    config.filter_parameters += [:password]
    config.active_record.whitelist_attributes = true
    config.assets.enabled = true
    config.assets.version = '1.0'
    config.autoload_paths += Dir["#{config.root}/app/models/**/"]
    config.to_prepare do
      Devise::Mailer.layout "mailout"
      Devise::Mailer.helper :application
    end
  end
end

GemLock:

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.8)
      actionpack (= 3.2.8)
      mail (~> 2.4.4)
    actionpack (3.2.8)
      activemodel (= 3.2.8)
      activesupport (= 3.2.8)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.0)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.1.3)
    activemodel (3.2.8)
      activesupport (= 3.2.8)
      builder (~> 3.0.0)
    activerecord (3.2.8)
      activemodel (= 3.2.8)
      activesupport (= 3.2.8)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.8)
      activemodel (= 3.2.8)
      activesupport (= 3.2.8)
    activesupport (3.2.8)
      i18n (~> 0.6)
      multi_json (~> 1.0)
    addressable (2.2.8)
    arel (3.0.2)
    aws-sdk (1.5.2)
      httparty (~> 0.7)
      json (~> 1.4)
      nokogiri (>= 1.4.4)
      uuidtools (~> 2.1)
    bcrypt-ruby (3.0.1)
    builder (3.0.0)
    cocaine (0.2.1)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.3.3)
    devise (2.1.0)
      bcrypt-ruby (~> 3.0)
      orm_adapter (~> 0.0.7)
      railties (~> 3.1)
      warden (~> 1.1.1)
    devise_invitable (1.0.2)
      devise (>= 2.0.0)
      rails (~> 3.0)
    erubis (2.7.0)
    execjs (1.3.2)
      multi_json (~> 1.0)
    faker (1.0.1)
      i18n (~> 0.4)
    heroku (2.25.0)
      launchy (>= 0.3.2)
      netrc (~> 0.7.1)
      rest-client (~> 1.6.1)
      rubyzip
    hike (1.2.1)
    httparty (0.8.3)
      multi_json (~> 1.0)
      multi_xml
    i18n (0.6.0)
    journey (1.0.4)
    jquery-rails (2.0.2)
      railties (>= 3.2.0, < 5.0)
      thor (~> 0.14)
    json (1.7.5)
    launchy (2.1.0)
      addressable (~> 2.2.6)
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.19)
    multi_json (1.3.6)
    multi_xml (0.5.1)
    mysql2 (0.3.11)
    netrc (0.7.1)
    nokogiri (1.5.2)
    orm_adapter (0.0.7)
    paperclip (2.7.0)
      activerecord (>= 2.3.0)
      activesupport (>= 2.3.2)
      cocaine (>= 0.0.2)
      mime-types
    pg (0.13.2)
    polyglot (0.3.3)
    rack (1.4.1)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.2)
      rack
    rack-test (0.6.1)
      rack (>= 1.0)
    rails (3.2.8)
      actionmailer (= 3.2.8)
      actionpack (= 3.2.8)
      activerecord (= 3.2.8)
      activeresource (= 3.2.8)
      activesupport (= 3.2.8)
      bundler (~> 1.0)
      railties (= 3.2.8)
    railties (3.2.8)
      actionpack (= 3.2.8)
      activesupport (= 3.2.8)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (0.9.2.2)
    rdoc (3.12)
      json (~> 1.4)
    redcarpet (1.17.2)
    rest-client (1.6.7)
      mime-types (>= 1.16)
    rubyzip (0.9.8)
    sass (3.1.18)
    sass-rails (3.2.5)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    sequel (3.20.0)
    sinatra (1.0)
      rack (>= 1.0)
    sprockets (2.1.3)
      hike (~> 1.2)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sqlite3 (1.3.6)
    taps (0.3.24)
      rack (>= 1.0.1)
      rest-client (>= 1.4.0, < 1.7.0)
      sequel (~> 3.20.0)
      sinatra (~> 1.0.0)
    thor (0.16.0)
    tilt (1.3.3)
    treetop (1.4.10)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.33)
    uglifier (1.2.4)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)
    uuidtools (2.1.2)
    warden (1.1.1)
      rack (>= 1.0)

PLATFORMS
  ruby

DEPENDENCIES
  aws-sdk
  coffee-rails (~> 3.2.1)
  devise
  devise_invitable
  faker
  heroku
  jquery-rails
  mysql2
  paperclip (~> 2.7)
  pg
  rails (= 3.2.8)
  redcarpet (= 1.17.2)
  sass-rails (~> 3.2.3)
  sqlite3
  taps
  uglifier (>= 1.0.3)
4

4 に答える 4

2

プロジェクト ファイル (特に Gemfile、config/environments/development.rb、application.rb) を見ずに鋭いアドバイスをすることは困難ですが、いつでも新しい Rails プロジェクトを生成し、現在のプロジェクトを 1 つずつ送信することができます。ファイルを最近作成されたファイルと比較して、問題の原因となっている正確な gem またはファイルを特定します。その後は、修正がはるかに簡単になると思います。それは一種の野蛮な力ですが、ノックダウンの状況で役立ちます

于 2012-09-29T22:22:26.230 に答える
2

reload! で問題を部分的にキャンセルできます。ここでは、開発環境で変更されたクラスのみを再充電する互換性のない宝石 (レール 3.2 を使用) があります。同等のものを見つけることができます。もしくは対応させてください。

https://github.com/paneq/active_reload

リロードも合体可能!ガード付き。 https://github.com/guard/guard

サーバーは起動時に開発モードと表示されますか? (あなたは彼に開発モードで起動するように頼んでいると思いますが、本当に開発モードで起動しますか?)

アップデート :

Rails 3.2 についての説明 (公式サイト):

最も顕著な新機能は、開発モードが 1.5 トン高速になったことです。Active Reload に着想を得て、実際に変更したファイルからのみクラスをリロードするようになりました。大規模なアプリケーションでは、その違いは劇的です。cf : http://weblog.rubyonrails.org/2012/1/20/rails-3-2-0-faster-dev-mode-routing-explain-queries-tagged-logger-store/

なんらかの理由で、Rails はファイル システムの変更を検出できません。

更新 2:

ソースが無効なフォルダーにないかどうかを確認します (Linux の観点から)。C:\invalid linux folder\something\rails\my_apps は、レールが相対パスを使用している場合に機能する可能性があることを意味します(よくわかりません)。しかし、レールのリロードが何らかの理由で絶対パスを使用する場合は、失敗します。

于 2012-10-03T14:44:29.217 に答える
1

あなたと私のものを比較してくださいconfig/environments/development.rb

SampleApp::Application.configure do

  config.cache_classes = false
  config.whiny_nils = true
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false
  config.action_mailer.raise_delivery_errors = false
  config.action_mailer.delivery_method = :letter_opener
  config.active_support.deprecation = :log
  config.action_dispatch.best_standards_support = :builtin
  config.active_record.mass_assignment_sanitizer = :strict
  config.active_record.auto_explain_threshold_in_seconds = 0.5
  config.assets.compress = false
  config.assets.debug = true
  config.domain = '.lvh.me'
end
于 2012-10-02T17:52:03.877 に答える
0

これを development.rb で試してください:

config.reload_classes_only_on_change = false

于 2013-10-14T19:37:32.053 に答える