Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 超类必须是类(模块给定)(TypeError)错误Rails 4 Ruby 2.1.2_Ruby On Rails_Ruby - Fatal编程技术网

Ruby on rails 超类必须是类(模块给定)(TypeError)错误Rails 4 Ruby 2.1.2

Ruby on rails 超类必须是类(模块给定)(TypeError)错误Rails 4 Ruby 2.1.2,ruby-on-rails,ruby,Ruby On Rails,Ruby,只是尝试在我的rails应用程序(rails 4,ruby 2.1.2)中运行迁移,并不断出现以下错误: superclass must be a Class (Module given) (TypeError) 以下是堆栈: rails g migration createCompany /home/javier/Drivers/app/models/driver.rb:1:in `<top (required)>': superclass must be a Class (Mo

只是尝试在我的rails应用程序(rails 4,ruby 2.1.2)中运行迁移,并不断出现以下错误:

superclass must be a Class (Module given) (TypeError)
以下是堆栈:

rails g migration createCompany
/home/javier/Drivers/app/models/driver.rb:1:in `<top (required)>': superclass must be a Class (Module given) (TypeError)
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:443:in `load'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:443:in `block in load_file'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:633:in `new_constants_in'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:442:in `load_file'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:342:in `require_or_load'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:480:in `load_missing_constant'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:180:in `const_missing'
    from /home/javier/Drivers/app/admin/driver.rb:1:in `<top (required)>'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `block in load'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
    from /home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/application.rb:179:in `block in load'
    from /home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/error.rb:23:in `capture'
    from /home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/application.rb:179:in `load'
    from /home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/application.rb:171:in `block in load!'
    from /home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/application.rb:171:in `each'
    from /home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/application.rb:171:in `load!'
    from /home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/application.rb:193:in `routes'
    from /home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin.rb:80:in `routes'
    from /home/javier/Drivers/config/routes.rb:8:in `block in <top (required)>'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:337:in `instance_exec'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:337:in `eval_block'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:315:in `draw'
    from /home/javier/Drivers/config/routes.rb:1:in `<top (required)>'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `block in load'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `each'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `load_paths'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:16:in `reload!'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:26:in `block in updater'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/file_update_checker.rb:75:in `call'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/file_update_checker.rb:75:in `execute'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:27:in `updater'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `run'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
    from /home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
    from /home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
    from /home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
    from /home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each'
    from /home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
    from /home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
    from /home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
    from /home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application.rb:300:in `initialize!'
    from /home/javier/Drivers/config/environment.rb:5:in `<top (required)>'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `block in require'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application.rb:276:in `require_environment!'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:147:in `require_application_and_environment!'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:133:in `generate_or_destroy'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:51:in `generate'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'
railsg迁移创建公司
/home/javier/Drivers/app/models/driver.rb:1:in`:超类必须是类(给定模块)(TypeError)
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:443:in'load'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:443:in`block in load\u file'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:633:in'new\u constants\u in'
来自/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:442:“加载文件”中
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:342:in'require\u或\u load'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:480:in'load\u missing\u constant'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:180:in'const\u missing'
from/home/javier/Drivers/app/admin/driver.rb:1:in`'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:241:in'load'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:241:“加载中的块”中
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:232:in'load\u dependency'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:241:in'load'
from/home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/application.rb:179:在“加载中的块”中
from/home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/error.rb:23:在“捕获”中
from/home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/application.rb:179:in'load'
from/home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/application.rb:171:在“加载中的块”中
from/home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/application.rb:171:in'each'
from/home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/application.rb:171:in'load!'
from/home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin/application.rb:193:in'routes'
from/home/javier/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-b8e89c747881/lib/active_admin.rb:80:in'routes'
from/home/javier/Drivers/config/routes.rb:8:in'block in'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action\u dispatch/routing/route\u set.rb:337:in'instance\u exec'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action\u dispatch/routing/route\u set.rb:337:in'eval_block'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action\u dispatch/routing/route\u set.rb:315:in'draw'
from/home/javier/Drivers/config/routes.rb:1:in`'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:241:in'load'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:241:“加载中的块”中
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:232:in'load\u dependency'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/dependencies.rb:241:in'load'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes\u reloader.rb:40:在“加载路径中的块”中
from/home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes\u reloader.rb:40:in“each”
from/home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes\u reloader.rb:40:在“加载路径”中
from/home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes\u reloader.rb:16:in“reload!”
from/home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes\u reloader.rb:26:in“block in updater”
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/file\u update\u checker.rb:75:in'call'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active\u support/file\u update\u checker.rb:75:在“执行”中
from/home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes\u reloader.rb:27:in'updater'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes\u reloader.rb:7:in'execute\u if\u updated'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/finisher.rb:71:in'block in'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:30:in'instance_exec'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:30:in'run'
from/home/javier/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:55:“运行中的块初始化器”
from/home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:226:in`block in tsort_each'
from/home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:348:在每个强连接的组件中的“块(2个级别)”中
from/home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:427:在“每个强连接的组件”中
from/home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:347:in“每个强连接的组件中的块”
from/home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in'each'
from/home/javier/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in`c
class Driver < Instructor 
    has_one :status
  has_many :driver_products
  has_many :driver_services
  has_many :services, :through => :driver_services
    belongs_to :town
  belongs_to :county 
  belongs_to :country

  geocoded_by :full_address
  after_validation :geocode, :on => :update


  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable

  def full_address
   "#{self.address_line_1}" + "," + "#{self.address_line_2}" 
  end

  def full_name
   "#{first_name}" + " " + "#{second_name}"
  end 
end
class AddSalePriceToSpreeVariants < SpreeExtension::Migration
  def change
    add_column :spree_variants, :sale_price, :decimal, precision: 8, scale: 2
  end
end
class AddSalePriceToSpreeVariants < SpreeExtension::Migration[6.0]
  def change
    add_column :spree_variants, :sale_price, :decimal, precision: 8, scale: 2
  end
end