Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save botanicus/123608 to your computer and use it in GitHub Desktop.
Save botanicus/123608 to your computer and use it in GitHub Desktop.
NameError (uninitialized constant TalentPool::Classification):
/vendor/rails/activesupport/lib/active_support/dependencies.rb:493:in `const_missing'
/vendor/rails/activerecord/lib/active_record/base.rb:1914:in `compute_type'
/vendor/rails/activerecord/lib/active_record/reflection.rb:133:in `send'
/vendor/rails/activerecord/lib/active_record/reflection.rb:133:in `klass'
/vendor/rails/activerecord/lib/active_record/reflection.rb:141:in `quoted_table_name'
/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb:96:in `construct_sql'
/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:8:in `initialize'
/vendor/rails/activerecord/lib/active_record/associations.rb:1136:in `new'
/vendor/rails/activerecord/lib/active_record/associations.rb:1136:in `classifications'
/vendor/rails/activerecord/lib/active_record/association_preload.rb:133:in `send'
/vendor/rails/activerecord/lib/active_record/association_preload.rb:133:in `preload_has_many_association'
/vendor/rails/activerecord/lib/active_record/association_preload.rb:133:in `each'
/vendor/rails/activerecord/lib/active_record/association_preload.rb:133:in `preload_has_many_association'
/vendor/rails/activerecord/lib/active_record/association_preload.rb:40:in `send'
/vendor/rails/activerecord/lib/active_record/association_preload.rb:40:in `preload_one_association'
/vendor/rails/activerecord/lib/active_record/association_preload.rb:38:in `each'
/vendor/rails/activerecord/lib/active_record/association_preload.rb:38:in `preload_one_association'
/vendor/rails/activerecord/lib/active_record/association_preload.rb:17:in `preload_associations'
/vendor/rails/activerecord/lib/active_record/association_preload.rb:16:in `preload_associations'
/vendor/rails/activerecord/lib/active_record/association_preload.rb:16:in `each'
/vendor/rails/activerecord/lib/active_record/association_preload.rb:16:in `preload_associations'
/vendor/rails/activerecord/lib/active_record/base.rb:1347:in `find_every'
/vendor/rails/activerecord/lib/active_record/base.rb:1380:in `find_one'
/vendor/rails/activerecord/lib/active_record/base.rb:1366:in `find_from_ids'
/vendor/rails/activerecord/lib/active_record/base.rb:541:in `find_without_trace_ActiveRecord___self_name__find'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/method_tracer.rb:118:in `find_without_trace_ActiveRecord_find'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/method_tracer.rb:38:in `trace_method_execution'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/method_tracer.rb:117:in `find_without_trace_ActiveRecord_find'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/method_tracer.rb:118:in `find_without_trace_ActiveRecord_all'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/method_tracer.rb:38:in `trace_method_execution'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/method_tracer.rb:117:in `find_without_trace_ActiveRecord_all'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/method_tracer.rb:118:in `find'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/method_tracer.rb:38:in `trace_method_execution'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/method_tracer.rb:117:in `find'
/app/controllers/admin/talent_pool_classifications_controller.rb:14:in `list'
/app/controllers/admin/talent_pool_classifications_controller.rb:8:in `index'
/vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `send'
/vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `perform_action_without_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:579:in `call_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:572:in `perform_action_without_benchmark'
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/vendor/rails/actionpack/lib/action_controller/rescue.rb:205:in `perform_action_without_caching'
/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action_without_newrelic_trace'
/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
/vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action_without_newrelic_trace'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/instrumentation/action_controller.rb:63:in `perform_action'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/method_tracer.rb:38:in `trace_method_execution'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/instrumentation/action_controller.rb:52:in `perform_action'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/method_tracer.rb:38:in `trace_method_execution'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/instrumentation/action_controller.rb:46:in `perform_action'
/vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'
/vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:568:in `process_without_session_management_support'
/vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `process'
/vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in `handle_request'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch_without_newrelic'
/vendor/plugins/newrelic_rpm/lib/newrelic/agent/instrumentation/dispatcher.rb:41:in `dispatch'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in `process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in `synchronize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in `process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
/vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `load'
/vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `load'
/vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
/vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `load'
/vendor/rails/railties/lib/commands/servers/mongrel.rb:64
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
/vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
/vendor/rails/railties/lib/commands/server.rb:39
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
./script/server:3
admin_talent_pool_classifications GET /admin/talent_pools/:talent_pool_id/classifications {:action=>"index", :controller=>"admin/talent_pool_classifications"}
formatted_admin_talent_pool_classifications GET /admin/talent_pools/:talent_pool_id/classifications.:format {:action=>"index", :controller=>"admin/talent_pool_classifications"}
POST /admin/talent_pools/:talent_pool_id/classifications {:action=>"create", :controller=>"admin/talent_pool_classifications"}
POST /admin/talent_pools/:talent_pool_id/classifications.:format {:action=>"create", :controller=>"admin/talent_pool_classifications"}
new_admin_talent_pool_classification GET /admin/talent_pools/:talent_pool_id/classifications/new {:action=>"new", :controller=>"admin/talent_pool_classifications"}
formatted_new_admin_talent_pool_classification GET /admin/talent_pools/:talent_pool_id/classifications/new.:format {:action=>"new", :controller=>"admin/talent_pool_classifications"}
edit_admin_talent_pool_classification GET /admin/talent_pools/:talent_pool_id/classifications/:id/edit {:action=>"edit", :controller=>"admin/talent_pool_classifications"}
formatted_edit_admin_talent_pool_classification GET /admin/talent_pools/:talent_pool_id/classifications/:id/edit.:format {:action=>"edit", :controller=>"admin/talent_pool_classifications"}
admin_talent_pool_classification GET /admin/talent_pools/:talent_pool_id/classifications/:id {:action=>"show", :controller=>"admin/talent_pool_classifications"}
formatted_admin_talent_pool_classification GET /admin/talent_pools/:talent_pool_id/classifications/:id.:format {:action=>"show", :controller=>"admin/talent_pool_classifications"}
PUT /admin/talent_pools/:talent_pool_id/classifications/:id {:action=>"update", :controller=>"admin/talent_pool_classifications"}
PUT /admin/talent_pools/:talent_pool_id/classifications/:id.:format {:action=>"update", :controller=>"admin/talent_pool_classifications"}
DELETE /admin/talent_pools/:talent_pool_id/classifications/:id {:action=>"destroy", :controller=>"admin/talent_pool_classifications"}
DELETE /admin/talent_pools/:talent_pool_id/classifications/:id.:format {:action=>"destroy", :controller=>"admin/talent_pool_classifications"}
map.namespace :admin do |admin|
admin.resources :vacancy_searches, :collection => {:closed => :get, :all => :get, :expired => :get}
admin.resources :vacancy_rfas, :path_prefix => "admin/vacancies/:vacancy_id", :as => "rfas" # urls /admin/vacancies/12/rfas
admin.resources :organisations, :collection => [:search] do |organisations|
organisations.resources :custom_locations, :member => [:delete]
organisations.resources :vblites, :collection => {:edit_draft => :get, :update_draft => :put, :publish_draft => :post, :draft => :get, :live => :get}
end
admin.resources :talent_pools, :collection => [:list_for_profiles], :member => [:publish, :show_for_profiles] do |talent_pools|
talent_pools.resources :sent_emails
# this should works, unfortunatelly it seems that we met a bug in rails resources
# admin_talent_pool_classifications
# /admin/talent_pools/:talent_pool_id/classifications
# {:action => "index", :controller=>"admin/talent_pool_classifications"}
# BUT we've got uninitialized constant TalentPool::Classification
talent_pools.resources :classifications, :controller => "talent_pool_classifications"
end
admin.resources :sites do |sites|
sites.resources :award_logos, :controller => "site_award_logos" # /sites/12/award_logos
end
admin.root :controller => "home"
end
# Represents a talent pool
# Talent pools are published onto multiple sites but are owned by a single organisation
class TalentPool < ActiveRecord::Base
validates_presence_of :name
validates_presence_of :organisation
validates_uniqueness_of :name, :scope => :organisation_id, :case_sensitive => false
belongs_to :organisation
has_many :published_talent_pools, :dependent => :destroy
has_many :sites, :through => :published_talent_pools
has_many :talent_pool_profiles, :conditions => ["disabled != 1"], :order => "created_at DESC", :dependent => :destroy
has_many :elements, :class_name => "TalentPoolElement", :foreign_key => "talent_pool_id", :order => "position", :dependent => :destroy
has_one :email_template
has_many :talent_pool_notifications, :dependent => :destroy
has_many :classifications
# checks if a talent_pool is published on a site
#
def on_site?(site)
if self.sites.include?(site)
return true
else
return false
end
end
def self.find_belonging_to_orgs(orgs,block=nil)
orgs = [orgs] unless orgs.class == Array
orglist = orgs.collect{ |o| o.id }
self.with_scope(:find => { :conditions => ["talent_pools.organisation_id in (?)",orglist]} ) do
if block.nil?
self.find(:all)
else
result = block.call
end
end
end
def owning_organisations
self.organisation.owning_organisations
end
end
class TalentPoolClassification < ActiveRecord::Base
belongs_to :talent_pool
has_many :talent_pool_profile_classifications
has_many :talent_pool_profiles, :through => :talent_pool_profile_classifications
end
class Admin::TalentPoolClassificationsController < Admin::AdminController
def list
@classification = TalentPoolClassification.new
@talent_pool = TalentPool.find(params[:talent_pool_id], :include => :classifications)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment