undefined class/module X in Rails 3 despite requiring models in initializer -
We use Rails.cache and see an undefined class / module X error when loading those squares Loads which call square X We follow the suggestion to include an initializer in which all the models in the Dev environment are required.
However, do we see the same error, any other suggestions? We include the starter code below, and from output to console, it seems like code is happening.
We are at Rail 3.2.12 + Ruby 1.9.3.
If Rails.env == "Evolution" Dir.foreach ("# {Rails.root} / App / Model"). Model_name | "Requiring defending: # {model_name}" is required unless model_name == "need_dependency model_name" || Stack trace:
Processing by DandyController as #get_apps JSON parameter: {"category" => Warning: Can not verify CSRF token authentication 2ms completed in the argumentsError (undefined category / module application) 500 internal server error, "attributes", "country_id" = "143,441" "language_id" app / controller / dandy_controller.rb: 66: ` 'apps get_featured_apps / controller / Dandy_controllerkrb: 50: sung in` get_apps C: /RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems / actionpack- 3.2.12 / lib / action_dispatch / middleware / templat es / Rescue / _trace.erb (2.0ms) sung Si: /RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 .12 / lib / action_dispatch / middleware / templat es / rescue / _reque st_and_response.erb (2.0ms) Sung Si: /RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/ middleware / template ES / Riscug / Daygnostiks.aarbi Riscug Get the app specially from #cache or db apps #defget_featur ed_apps (country_id) in the / layout (46.0 ms) code = Rails .cache.fetch ('featured_apps', {expires_in = & gt; 1.days}) logger.info '+++ cache miss: Featured Apps' get_featured_apps_helper country_id end # to Get Sponsored Results apps = back get_featured_apps_helper country_id # Featured Apps Back app and <
I overwrote the free method that works wonders for me!
Not to Rails.env.production? Module ActiveSupport module cache class collection def fetch (name, options = nil) if block_given? Yield end and end and end
Comments
Post a Comment