I have same class in main application and a gem (mountable engine).
I want to reopen the class(defined in main applicaion) in the gem.
Main application has
app/models/test.rb
class Test
def original_method
end
end
in Gemfile
gem 'gem_name'
In the gem
app/models/test.rb
class Test
def add_method
end
end
But main application raises an error that Test#original_method is not defined.
It looks like Test class is overwritten in the gem. Why not reopen?
How can I solve the problem??
EDIT
NoMethodError (undefined method `original_method' for #<Test:0x0000001997ca70>):
vendor/bundle/ruby/1.9.1/gems/activemodel-3.2.13/lib/active_model/attribute_methods.rb:407:in `method_missing'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/attribute_methods.rb:149:in `method_missing'
vendor/bundle/ruby/1.9.1/bundler/gems/test_gem/app/controllers/tests_controller.rb:213:in `new'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:167:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/rendering.rb:10:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:535:in `_run__422315203817736318__process_action__439125674649202736__callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:17:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:29:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in `process'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in `call'
vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call'
vendor/bundle/ruby/1.9.1/gems/warden-1.2.1/lib/warden/manager.rb:35:in `block in call'
vendor/bundle/ruby/1.9.1/gems/warden-1.2.1/lib/warden/manager.rb:34:in `catch'
vendor/bundle/ruby/1.9.1/gems/warden-1.2.1/lib/warden/manager.rb:34:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__4226710667851682500__call__4227166089575601802__callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:65:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/log_tailer.rb:17:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/local/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
try
Test.class_eval do
def original_method
end
end
This is an old question, but I just came across it looking for an answer and found my own. Here's how I did it in a Rails app. Basically, instead of reopening the class you put the code in a module and include it in the original class.
# lib/extensions/gem_name/name_of_feature.rb
module Extensions
module GemName
module NameOfFeature
def self.included(base)
base.extend ClassMethods
base.class_eval do
# Things like association macros here
# I.ex. belongs_to :foo
end
end
def some_instance_method
# Do something
end
module ClassMethods
def some_class_method
# Do something
end
end
end
end
end
# config/initializers/gem_name.rb
require "extensions/gem_name/name_of_feature"
GemClassToExtend.include Extensions::GemName::NameOfFeature
So now you can:
GemClassToExtend.some_class_method
GemClassToExtend.new.some_instance_method
You have two test.rb files and only one of them is being loaded in your current environment. I recommend creating a mixin module in your application and then including it into the Test class defined in the gem.
module TestExtensions
def original_method
end
end
Test.include(TestExtensions)
Aside: I typically discourage monkey patching gem dependencies in this manner. Consider making a wrapper around Test.
The exception you have attached claims about undefined method original_method? not original_method. Looks like you are trying to call a method with ? at the end while it is not defined.
Related
I am trying to deploy a simple Rails 5 application in Heroku which has devise authentication enabled. I have followed a tutorial to deploy the Rails app on Heroku. The app is running and the database is also setup.
When I try to load the initial page of the app, where the user must be redirected to login page, I am getting following exception (in Heroku logs) -
Started GET "/" for 203.187.254.82 at 2018-05-04 10:28:24 +0000
Processing by HomeController#index as HTML
Completed 401 Unauthorized in 1ms
NoMethodError (undefined method `merge' for nil:NilClass):
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:805:in `url_for'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:277:in `call'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:218:in `call'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:335:in `block (2 levels) in define_url_helper'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/routing/routes_proxy.rb:42:in `new_user_session_url'
vendor/bundle/ruby/2.3.0/gems/devise-4.4.3/lib/devise/failure_app.rb:153:in `scope_url'
vendor/bundle/ruby/2.3.0/gems/devise-4.4.3/lib/devise/failure_app.rb:128:in `redirect_url'
vendor/bundle/ruby/2.3.0/gems/devise-4.4.3/lib/devise/failure_app.rb:88:in `redirect'
vendor/bundle/ruby/2.3.0/gems/devise-4.4.3/lib/devise/failure_app.rb:43:in `respond'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:186:in `process_action'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:124:in `process'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_controller/metal.rb:189:in `dispatch'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_controller/metal.rb:242:in `block in action'
vendor/bundle/ruby/2.3.0/gems/devise-4.4.3/lib/devise/failure_app.rb:23:in `call'
vendor/bundle/ruby/2.3.0/gems/devise-4.4.3/lib/devise/delegator.rb:7:in `call'
vendor/bundle/ruby/2.3.0/gems/warden-1.2.7/lib/warden/manager.rb:143:in `call_failure_app'
vendor/bundle/ruby/2.3.0/gems/warden-1.2.7/lib/warden/manager.rb:129:in `process_unauthenticated'
vendor/bundle/ruby/2.3.0/gems/warden-1.2.7/lib/warden/manager.rb:44:in `call'
vendor/bundle/ruby/2.3.0/gems/rack-2.0.5/lib/rack/etag.rb:25:in `call'
vendor/bundle/ruby/2.3.0/gems/rack-2.0.5/lib/rack/conditional_get.rb:25:in `call'
vendor/bundle/ruby/2.3.0/gems/rack-2.0.5/lib/rack/head.rb:12:in `call'
vendor/bundle/ruby/2.3.0/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:232:in `context'
vendor/bundle/ruby/2.3.0/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:226:in `call'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/middleware/cookies.rb:613:in `call'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:97:in `run_callbacks'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/middleware/callbacks.rb:24:in `call'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/rack/logger.rb:36:in `call_app'
vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/rack/logger.rb:24:in `block in call'
vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/tagged_logging.rb:69:in `block in tagged'
vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/tagged_logging.rb:26:in `tagged'
vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/tagged_logging.rb:69:in `tagged'
vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/rack/logger.rb:24:in `call'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/middleware/request_id.rb:25:in `call'
vendor/bundle/ruby/2.3.0/gems/rack-2.0.5/lib/rack/method_override.rb:22:in `call'
vendor/bundle/ruby/2.3.0/gems/rack-2.0.5/lib/rack/runtime.rb:22:in `call'
vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.6/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/middleware/executor.rb:12:in `call'
vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/middleware/static.rb:125:in `call'
vendor/bundle/ruby/2.3.0/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call'
vendor/bundle/ruby/2.3.0/gems/railties-5.1.6/lib/rails/engine.rb:522:in `call'
vendor/bundle/ruby/2.3.0/gems/puma-3.11.4/lib/puma/configuration.rb:225:in `call'
vendor/bundle/ruby/2.3.0/gems/puma-3.11.4/lib/puma/server.rb:632:in `handle_request'
vendor/bundle/ruby/2.3.0/gems/puma-3.11.4/lib/puma/server.rb:446:in `process_client'
vendor/bundle/ruby/2.3.0/gems/puma-3.11.4/lib/puma/server.rb:306:in `block in run'
vendor/bundle/ruby/2.3.0/gems/puma-3.11.4/lib/puma/thread_pool.rb:120:in `block in spawn_thread'
home_controller.rb
class HomeController < ApplicationController
before_action :authenticate_user!
def index
#activities = nil
end
def posts
#posts = Post.all.order("created_at DESC")
end
end
What am I missing here? Not able to understand whether the exception is from the devise library or my application code.
I have resolved it. I found it from actionpack's code that url_for method requires default_url_options config to be set in respective environment file.
In my case it was in production.rb file.
I had to put-in -
config.action_mailer.default_url_options = { :host => '<YOUR_HEROKU_APP_URL_HERE>' }
In my project I am using a one-to-many relationship between games and ticker_activites like this
Model
class Game < ActiveRecord::Base
has_many :ticker_activities, :dependent => :destroy, :order => 'time ASC'
end
class TickerActivity < ActiveRecord::Base
belongs_to :game
end
When deleting a game...
View
<td><%= link_to 'Destroy', game, confirm: 'Are you sure?', method: :delete %></td>
Controller
def destroy
#game = Game.find(params[:id])
#game.destroy <-------error highlights on this line
end
.. I am getting this error...
undefined method `name' for nil:NilClass
Parameters
{"_method"=>"delete",
"authenticity_token"=>"684Odq56+B...",
"id"=>"20"}
... and the game will not be deleted in production (Heroku).
I am using Ruby 2.2.4 and Rails 3.2.20.
Any ideas how to solve this problem?
Edit:
My ticker_activity.rb:
class TickerActivity < ActiveRecord::Base
belongs_to :game
belongs_to :player
belongs_to :team
def self.convert_seconds_to_time(seconds)
total_minutes = seconds / 1.minutes
seconds_in_last_minute = seconds - total_minutes.minutes.seconds
"#{sprintf '%02d', total_minutes}:#{sprintf '%02d', seconds_in_last_minute}"
end
# Import CSV-File
def self.import(file)
CSV.foreach(file.path, headers: true) do |row|
ticker_hash = row.to_hash
TickerActivity.create!(ticker_hash)
end
end
end
Full Trace
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/has_many_association.rb:58:in `cached_counter_attribute_name'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/has_many_association.rb:81:in `inverse_updates_counter_cache?'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/has_many_association.rb:91:in `delete_records'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/collection_association.rb:466:in `remove_records'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/collection_association.rb:459:in `block in delete_or_destroy'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/collection_association.rb:149:in `block in transaction'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/transactions.rb:208:in `transaction'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/collection_association.rb:148:in `transaction'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/collection_association.rb:459:in `delete_or_destroy'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/collection_association.rb:231:in `delete'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/collection_association.rb:157:in `delete_all'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/collection_proxy.rb:46:in `delete_all'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/builder/has_many.rb:42:in `block in define_destroy_dependency_method'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/callbacks.rb:407:in `_run__4425773486301104750__destroy__2967777598099461333__callbacks'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/callbacks.rb:385:in `_run_destroy_callbacks'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/callbacks.rb:254:in `destroy'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/transactions.rb:254:in `block in destroy'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/transactions.rb:208:in `transaction'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/transactions.rb:254:in `destroy'
app/controllers/games_controller.rb:77:in `destroy'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/abstract_controller/base.rb:167:in `process_action'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_controller/metal/rendering.rb:10:in `process_action'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/callbacks.rb:414:in `_run__924265301303643032__process_action__1711436731218752401__callbacks'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/abstract_controller/callbacks.rb:17:in `process_action'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_controller/metal/rescue.rb:29:in `process_action'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/notifications.rb:123:in `block in instrument'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/notifications.rb:123:in `instrument'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
vendor/bundle/ruby/2.2.0/gems/searchkick-1.3.0/lib/searchkick/logging.rb:153:in `process_action'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/abstract_controller/base.rb:121:in `process'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/abstract_controller/rendering.rb:45:in `process'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_controller/metal.rb:203:in `dispatch'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_controller/metal.rb:246:in `block in action'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/routing/route_set.rb:73:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/routing/route_set.rb:36:in `call'
vendor/bundle/ruby/2.2.0/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
vendor/bundle/ruby/2.2.0/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
vendor/bundle/ruby/2.2.0/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/routing/route_set.rb:608:in `call'
vendor/bundle/ruby/2.2.0/gems/warden-1.2.6/lib/warden/manager.rb:35:in `block in call'
vendor/bundle/ruby/2.2.0/gems/warden-1.2.6/lib/warden/manager.rb:34:in `catch'
vendor/bundle/ruby/2.2.0/gems/warden-1.2.6/lib/warden/manager.rb:34:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-1.4.7/lib/rack/etag.rb:23:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-1.4.7/lib/rack/conditionalget.rb:35:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/middleware/head.rb:14:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/middleware/flash.rb:242:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-1.4.7/lib/rack/session/abstract/id.rb:210:in `context'
vendor/bundle/ruby/2.2.0/gems/rack-1.4.7/lib/rack/session/abstract/id.rb:205:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/middleware/cookies.rb:341:in `call'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/query_cache.rb:64:in `call'
vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/callbacks.rb:405:in `_run__2936395425807340860__call__2967777598099461333__callbacks'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
vendor/bundle/ruby/2.2.0/gems/railties-3.2.20/lib/rails/rack/logger.rb:32:in `call_app'
vendor/bundle/ruby/2.2.0/gems/railties-3.2.20/lib/rails/rack/logger.rb:16:in `block in call'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/tagged_logging.rb:22:in `tagged'
vendor/bundle/ruby/2.2.0/gems/railties-3.2.20/lib/rails/rack/logger.rb:16:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/middleware/request_id.rb:22:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-1.4.7/lib/rack/methodoverride.rb:21:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-1.4.7/lib/rack/runtime.rb:17:in `call'
vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.20/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-1.4.7/lib/rack/lock.rb:15:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-3.2.20/lib/action_dispatch/middleware/static.rb:82:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-cache-1.6.1/lib/rack/cache/context.rb:140:in `forward'
vendor/bundle/ruby/2.2.0/gems/rack-cache-1.6.1/lib/rack/cache/context.rb:147:in `pass'
vendor/bundle/ruby/2.2.0/gems/rack-cache-1.6.1/lib/rack/cache/context.rb:159:in `invalidate'
vendor/bundle/ruby/2.2.0/gems/rack-cache-1.6.1/lib/rack/cache/context.rb:74:in `call!'
vendor/bundle/ruby/2.2.0/gems/rack-cache-1.6.1/lib/rack/cache/context.rb:51:in `call'
vendor/bundle/ruby/2.2.0/gems/railties-3.2.20/lib/rails/engine.rb:484:in `call'
vendor/bundle/ruby/2.2.0/gems/railties-3.2.20/lib/rails/application.rb:231:in `call'
vendor/bundle/ruby/2.2.0/gems/railties-3.2.20/lib/rails/railtie/configurable.rb:30:in `method_missing'
vendor/bundle/ruby/2.2.0/gems/thin-1.7.0/lib/thin/connection.rb:86:in `block in pre_process'
vendor/bundle/ruby/2.2.0/gems/thin-1.7.0/lib/thin/connection.rb:84:in `catch'
vendor/bundle/ruby/2.2.0/gems/thin-1.7.0/lib/thin/connection.rb:84:in `pre_process'
vendor/bundle/ruby/2.2.0/gems/thin-1.7.0/lib/thin/connection.rb:53:in `process'
vendor/bundle/ruby/2.2.0/gems/thin-1.7.0/lib/thin/connection.rb:39:in `receive_data'
vendor/bundle/ruby/2.2.0/gems/eventmachine-1.2.0.1/lib/eventmachine.rb:194:in `run_machine'
vendor/bundle/ruby/2.2.0/gems/eventmachine-1.2.0.1/lib/eventmachine.rb:194:in `run'
vendor/bundle/ruby/2.2.0/gems/thin-1.7.0/lib/thin/backends/base.rb:73:in `start'
vendor/bundle/ruby/2.2.0/gems/thin-1.7.0/lib/thin/server.rb:162:in `start'
vendor/bundle/ruby/2.2.0/gems/thin-1.7.0/lib/thin/controllers/controller.rb:87:in `start'
vendor/bundle/ruby/2.2.0/gems/thin-1.7.0/lib/thin/runner.rb:200:in `run_command'
vendor/bundle/ruby/2.2.0/gems/thin-1.7.0/lib/thin/runner.rb:156:in `run!'
vendor/bundle/ruby/2.2.0/gems/thin-1.7.0/bin/thin:6:in `<top (required)>'
vendor/bundle/ruby/2.2.0/bin/thin:23:in `load'
vendor/bundle/ruby/2.2.0/bin/thin:23:in `<main>'
error logs
2016-06-21T07:15:01.216797+00:00 app[web.1]: Started DELETE "/games/21" for 176.0.32.209 at 2016-06-21 07:15:01 +0000
2016-06-21T07:15:01.223899+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/has_many_association.rb:53: warning: circular argument reference - reflection
2016-06-21T07:15:01.223919+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/has_many_association.rb:57: warning: circular argument reference - reflection
2016-06-21T07:15:01.223948+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/has_many_association.rb:61: warning: circular argument reference - reflection
2016-06-21T07:15:01.254045+00:00 app[web.1]:
2016-06-21T07:15:01.254042+00:00 app[web.1]: NoMethodError (undefined method `name' for nil:NilClass):
2016-06-21T07:15:01.254045+00:00 app[web.1]:
2016-06-21T07:15:01.254044+00:00 app[web.1]: app/controllers/games_controller.rb:77:in `destroy'
2016-06-21T07:15:01.254004+00:00 app[web.1]:
2016-06-21T07:15:01.224044+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.20/lib/active_record/associations/has_many_association.rb:80: warning: circular argument reference - reflection
I am upgrading from rails 2.3 to rails 3.2. I have models divided into sub folders. Just like there is a model app/models/ad/ad.rb the other app/models/ad/ad_city.rb but inside the model it is written as:
class Ad < ActiveRecord::Base
class AdCity < ActiveRecord::Base
and not:
class Ad::Ad < ActiveRecord::Base
class Ad::AdCity < ActiveRecord::Base
I have in my application.rb:
config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**}')]
even I tried including each folder in config.autoload_paths. But it give me a thousand lines warning:
Warning: Error loading /home/deep/projects/upgrade/models/myapp/app/models/ad/ad_city.rb:
uninitialized constant Ad::AdCity
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/inflector/methods.rb:230:in `block in constantize'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/inflector/methods.rb:229:in `each'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/inflector/methods.rb:229:in `constantize'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:64:in `block (2 levels) in load_models'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:54:in `each'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:54:in `block in load_models'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:53:in `each'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:53:in `load_models'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:15:in `prepare'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx.rb:81:in `block in context'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx.rb:78:in `synchronize'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx.rb:78:in `context'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/thinking-sphinx-2.0.11/lib/thinking_sphinx/active_record.rb:162:in `define_index'
/home/deep/projects/upgrade/models/myapp/app/models/user/user_indexes.rb:6:in `included'
/home/deep/projects/upgrade/models/myapp/app/models/user/user.rb:295:in `include'
/home/deep/projects/upgrade/models/myapp/app/models/user/user.rb:295:in `<class:User>'
/home/deep/projects/upgrade/models/myapp/app/models/user/user.rb:1:in `<top (required)>'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/dependencies_patch.rb:364:in `block in load_file_with_constant_tracking_internal'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/dependencies_patch.rb:240:in `now_loading'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/dependencies_patch.rb:364:in `load_file_with_constant_tracking_internal'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/dependencies_patch.rb:234:in `block in load_file_with_constant_tracking'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/dependencies_patch.rb:383:in `async_synchronize'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/dependencies_patch.rb:229:in `load_file_with_constant_tracking'
/home/deep/projects/upgrade/models/myapp/lib/authenticated_system.rb:108:in `login_from_session'
/home/deep/projects/upgrade/models/myapp/lib/authenticated_system.rb:24:in `current_user'
/home/deep/projects/upgrade/models/myapp/lib/authenticated_system.rb:14:in `logged_in?'
/home/deep/projects/upgrade/models/myapp/app/controllers/application_controller.rb:288:in `set_timezone'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:429:in `_run__402496120916004207__process_action__1098406492416702350__callbacks'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/abstract_controller/callbacks.rb:17:in `process_action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal/rescue.rb:29:in `process_action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/notifications.rb:123:in `block in instrument'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/notifications.rb:123:in `instrument'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activerecord-3.2.19/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/abstract_controller/base.rb:121:in `process'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/abstract_controller/rendering.rb:45:in `process'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal.rb:203:in `dispatch'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_controller/metal.rb:246:in `block in action'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/routing/route_set.rb:73:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/routing/route_set.rb:36:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/routing/route_set.rb:608:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/exception_notification-4.0.1/lib/exception_notification/rack.rb:28:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/bundler/gems/rails-dev-boost-bf49caca6670/lib/rails_development_boost/async.rb:14:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/head.rb:14:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/flash.rb:242:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/cookies.rb:341:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activerecord-3.2.19/lib/active_record/query_cache.rb:64:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:405:in `_run__2960753221531180313__call__4371824738127159201__callbacks'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/reloader.rb:65:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/better_errors-2.0.0/lib/better_errors/middleware.rb:84:in `protected_app_call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/better_errors-2.0.0/lib/better_errors/middleware.rb:79:in `better_errors_call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/better_errors-2.0.0/lib/better_errors/middleware.rb:57:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/railties-3.2.19/lib/rails/rack/logger.rb:32:in `call_app'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/railties-3.2.19/lib/rails/rack/logger.rb:16:in `block in call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/tagged_logging.rb:22:in `tagged'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/railties-3.2.19/lib/rails/rack/logger.rb:16:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/request_id.rb:22:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/activesupport-3.2.19/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/actionpack-3.2.19/lib/action_dispatch/middleware/static.rb:63:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/railties-3.2.19/lib/rails/engine.rb:484:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/railties-3.2.19/lib/rails/application.rb:231:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/railties-3.2.19/lib/rails/rack/log_tailer.rb:17:in `call'
/home/deep/.rvm/gems/ruby-2.1.2#upgrade_mygemset/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
/home/deep/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/home/deep/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/home/deep/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
for all the models. It doesn't throw any error just gives warning each time my app makes any connection with the database. What should I do. Please help
I would like to know how to fix the error below.
My code:
controllers/application_controller.rb
class ApplicationController < ActionController::Base
def home
#app_name = Cache.app_name
respond_to do |format|
format.html {render "application/home"}
end
end
views/application/home.html.erb
<h1>Home</h1>
Error:
Missing template application/home with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :arb, :rabl]}. Searched in: * "/srv/www/intel/releases/20140509010259/app/views" * "/home/deploy/.bundler/intel/ruby/1.9.1/gems/ckeditor-4.0.11/app/views" * "/home/deploy/.bundler/intel/ruby/1.9.1/bundler/gems/active_admin-b41450a52c09/app/views" * "/home/deploy/.bundler/intel/ruby/1.9.1/gems/kaminari-0.15.1/app/views" * "/home/deploy/.bundler/intel/ruby/1.9.1/gems/devise-3.2.4/app/views"
BACKTRACE:
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_view/path_set.rb:58:in `find'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_view/lookup_context.rb:122:in `find'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_view/renderer/abstract_renderer.rb:3:in `find_template'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_view/renderer/template_renderer.rb:34:in `determine_template'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/newrelic_rpm-3.8.0.218/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:157:in `render_with_newrelic'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_view/renderer/renderer.rb:36:in `render_template'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_view/renderer/renderer.rb:17:in `render'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/rendering.rb:110:in `_render_template'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/streaming.rb:225:in `_render_template'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/rendering.rb:103:in `render_to_body'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/rendering.rb:88:in `render'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/rendering.rb:16:in `render'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/usr/local/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/core_ext/benchmark.rb:5:in `ms'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/instrumentation.rb:40:in `block in render'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/instrumentation.rb:39:in `render'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/base.rb:167:in `process_action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/rendering.rb:10:in `process_action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:447:in `_run__2038047062599410293__process_action__4203207241704581942__callbacks'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/callbacks.rb:17:in `process_action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/rescue.rb:29:in `process_action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/notifications.rb:123:in `block in instrument'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/notifications.rb:123:in `instrument'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/newrelic_rpm-3.8.0.218/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:38:in `block in process_action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/newrelic_rpm-3.8.0.218/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:336:in `perform_action_with_newrelic_trace'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/newrelic_rpm-3.8.0.218/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:37:in `process_action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/base.rb:121:in `process'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/abstract_controller/rendering.rb:45:in `process'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal.rb:203:in `dispatch'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_controller/metal.rb:246:in `block in action'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/routing/route_set.rb:73:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/routing/route_set.rb:36:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/routing/route_set.rb:608:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:186:in `call!'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:164:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/omniauth-1.2.1/lib/omniauth/builder.rb:59:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/newrelic_rpm-3.8.0.218/lib/new_relic/rack/error_collector.rb:55:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/newrelic_rpm-3.8.0.218/lib/new_relic/rack/agent_hooks.rb:32:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/newrelic_rpm-3.8.0.218/lib/new_relic/rack/browser_monitoring.rb:27:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-1.4.5/lib/rack/deflater.rb:13:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/head.rb:14:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/flash.rb:242:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/cookies.rb:341:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/query_cache.rb:64:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:405:in `_run__3093961360070573583__call__3302946055201972876__callbacks'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/railties-3.2.18/lib/rails/rack/logger.rb:32:in `call_app'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/railties-3.2.18/lib/rails/rack/logger.rb:16:in `block in call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/tagged_logging.rb:22:in `tagged'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/railties-3.2.18/lib/rails/rack/logger.rb:16:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/request_id.rb:22:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/static.rb:63:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-timeout-0.0.4/lib/rack/timeout.rb:16:in `block in call'
/usr/local/lib/ruby/1.9.1/timeout.rb:69:in `timeout'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/rack-timeout-0.0.4/lib/rack/timeout.rb:16:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/railties-3.2.18/lib/rails/engine.rb:484:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/railties-3.2.18/lib/rails/application.rb:231:in `call'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/railties-3.2.18/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:572:in `process_client'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:666:in `worker_loop'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:521:in `spawn_missing_workers'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:140:in `start'
/home/deploy/.bundler/intel/ruby/1.9.1/gems/unicorn-4.8.2/bin/unicorn_rails:209:in `'
/home/deploy/.bundler/intel/ruby/1.9.1/bin/unicorn_rails:23:in `load'
/home/deploy/.bundler/intel/ruby/1.9.1/bin/unicorn_rails:23:in `'
Hint: You should not place public methods into your application_controller. Have an extra controller for that and check your routes.rb and view files names:
# in app/controllers/home_controller.rb
class HomeController < ApplicationController
def index
#app_name = Cache.app_name
end
end
# in app/views/home/index.html.erb
<h1>Home of <%= #app_name %></h1>
# in config/routes.rb
root to: 'home#index'
You can use the rails generator to create a new controller to place that. Don't use the Application controller.
For example:
rails g controller home index
This will create a Home controller and an index action and the default files needed. It will also create the routes and assets for you.
I have installed the gem bullet to enhance performences on my small app (which is running with Rails 4 Edge)
However, the '.includes' method doesn't seem to work:
def index
#articles = Article.includes(:category)
end
This returns 'can't convert Symbol into Integer'
Same goes when I'm running this in the rails console, for any association I got this same error; is .includes is deprecated, or am I doing it wrong?
Thanks
Here is the fulltrace:
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader/association.rb:106:in `[]'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader/association.rb:106:in `build_scope'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader/association.rb:28:in `scope'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader/association.rb:32:in `records_for'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader/association.rb:80:in `block in associated_records_by_owner'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader/association.rb:80:in `each'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader/association.rb:80:in `each_slice'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader/association.rb:80:in `each'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader/association.rb:80:in `map'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader/association.rb:80:in `associated_records_by_owner'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader/singular_association.rb:9:in `preload'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader/association.rb:19:in `run'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader.rb:129:in `block (2 levels) in preload_one'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader.rb:128:in `each'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader.rb:128:in `block in preload_one'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader.rb:127:in `each'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader.rb:127:in `preload_one'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader.rb:104:in `preload'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader.rb:93:in `block in run'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader.rb:93:in `each'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/associations/preloader.rb:93:in `run'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/relation.rb:570:in `block in exec_queries'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/relation.rb:569:in `each'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/relation.rb:569:in `exec_queries'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/relation.rb:456:in `block in load'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/explain.rb:29:in `logging_query_plan'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/relation.rb:456:in `load'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/relation.rb:197:in `to_a'
bullet (4.3.0) lib/bullet/active_record3x.rb:10:in `to_a'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/relation/delegation.rb:13:in `each'
app/views/articles/index.html.slim:44:in `_app_views_articles_index_html_slim___1140651801917805301_70356832595700'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_view/template.rb:144:in `block in render'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/notifications.rb:160:in `instrument'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_view/template.rb:142:in `render'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_view/renderer/template_renderer.rb:49:in `block (2 levels) in render_template'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_view/renderer/abstract_renderer.rb:23:in `block in instrument'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/notifications.rb:158:in `block in instrument'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/notifications.rb:158:in `instrument'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_view/renderer/abstract_renderer.rb:23:in `instrument'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_view/renderer/template_renderer.rb:48:in `block in render_template'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_view/renderer/template_renderer.rb:56:in `render_with_layout'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_view/renderer/template_renderer.rb:47:in `render_template'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_view/renderer/template_renderer.rb:17:in `render'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_view/renderer/renderer.rb:36:in `render_template'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_view/renderer/renderer.rb:17:in `render'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/abstract_controller/rendering.rb:119:in `_render_template'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/streaming.rb:219:in `_render_template'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/abstract_controller/rendering.rb:112:in `render_to_body'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/rendering.rb:33:in `render_to_body'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/renderers.rb:26:in `render_to_body'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/abstract_controller/rendering.rb:97:in `render'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/rendering.rb:16:in `render'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/core_ext/benchmark.rb:5:in `ms'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/instrumentation.rb:41:in `block in render'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/instrumentation.rb:40:in `render'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/abstract_controller/base.rb:189:in `process_action'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/rendering.rb:10:in `process_action'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/callbacks.rb:413:in `_run__4416358697319013222__process_action__callbacks'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/callbacks.rb:78:in `run_callbacks'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/abstract_controller/callbacks.rb:17:in `process_action'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/rescue.rb:29:in `process_action'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/notifications.rb:158:in `block in instrument'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/notifications.rb:158:in `instrument'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/abstract_controller/base.rb:136:in `process'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/abstract_controller/rendering.rb:44:in `process'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal.rb:195:in `dispatch'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_controller/metal.rb:231:in `block in action'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/routing/route_set.rb:77:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/routing/route_set.rb:77:in `dispatch'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/routing/route_set.rb:45:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/journey/router.rb:69:in `block in call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/journey/router.rb:57:in `each'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/journey/router.rb:57:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/routing/route_set.rb:614:in `call'
bullet (4.3.0) lib/bullet/rack.rb:11:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.2) lib/rack/etag.rb:23:in `call'
rack (1.4.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.4.2) lib/rack/head.rb:9:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/middleware/params_parser.rb:30:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/middleware/flash.rb:233:in `call'
rack (1.4.2) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.2) lib/rack/session/abstract/id.rb:205:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/middleware/cookies.rb:443:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/query_cache.rb:36:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:631:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activerecord/lib/active_record/migration.rb:348:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/callbacks.rb:373:in `_run__1420375788820113751__call__callbacks'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/callbacks.rb:78:in `run_callbacks'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/middleware/reloader.rb:64:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/railties/lib/rails/rack/logger.rb:32:in `call_app'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/railties/lib/rails/rack/logger.rb:16:in `block in call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/tagged_logging.rb:67:in `block in tagged'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/tagged_logging.rb:25:in `tagged'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/tagged_logging.rb:67:in `tagged'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/railties/lib/rails/rack/logger.rb:16:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.4.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.2) lib/rack/runtime.rb:17:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/activesupport/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.2) lib/rack/lock.rb:15:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/actionpack/lib/action_dispatch/middleware/static.rb:63:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/railties/lib/rails/engine.rb:508:in `call'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/rails-e63e280bed3a/railties/lib/rails/application.rb:95:in `call'
rack (1.4.2) lib/rack/lock.rb:15:in `call'
rack (1.4.2) lib/rack/content_length.rb:14:in `call'
rack (1.4.2) lib/rack/handler/webrick.rb:59:in `service'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/home/shideneyu/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
Last but not least, where the error is:
th Actions
tbody
- #articles.each do |article| <---- This line is highlited for the error
tr
td
div class="span1"
Article Model:
class Article < ActiveRecord::Base
attr_readonly :user_id
belongs_to :category
belongs_to :user
with_options(dependent: :destroy) do |opts|
opts.has_many :events, as: :eventable
opts.has_many :mentions, as: :mentionable
opts.has_many :comments, as: :commentable
end
has_and_belongs_to_many :tags, :uniq => true
validates_presence_of :category, :content
validates_uniqueness_of :name, scope: :category_id
end
.includes method works for instances that means your method should look like this :
def index
#articles = Article.includes(:category).find(1)
end
or for example of collection
def index
#articles = #blog.articles.includes(:category)
end