- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
只是试图在我的 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>'
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
错误已解决...
关于ruby-on-rails - 父类(super class)必须是一个类(给定模块)(TypeError)错误 Rails 4 Ruby 2.1.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25318650/
我感到困惑...... 我在 .jsp 中编写了一个小例程。最后需要关闭ResultSet、Statement和Connection。我也在finally { }中编写了结束代码,但是当页面运行时,它
我在 Stack Overflow 上读到一些 C 函数是“过时的”或“应该避免”。你能给我一些这种功能的例子以及原因吗? 这些功能有哪些替代方案? 我们可以安全地使用它们 - 有什么好的做法吗? 最
我正在构建一个应用程序,它可以拍照、显示图片,然后一旦被点击,就会在点击的任何地方返回图片的颜色。 它在崩溃之前到达了水龙头。我得到 x 必须是 < bitmap.width() 的错误 就我的理解而
我试图根据几个因素向用户提出建议: •建议只能是同一所大学的学生•建议必须至少匹配一个其他字段 我以为我有它,但问题是这个查询将返回同一所学校的所有学生,而不管其他情况: PUT /user/.per
我的应用程序必须从第三方读取 SSL 网址。我如何最好地将第三方凭证存储在我自己的数据库中,以保护第三方凭证不被泄露?兼顾绝对的安全性和实用性。对凭据进行单向哈希处理没有用,因为我必须将凭据恢复为明文
在我的 Rails API 中,我希望 Mongo 对象作为 JSON 字符串返回,Mongo UID 作为“id”属性而不是“_id”对象。 我希望我的 API 返回以下 JSON: { "
假设应用层协议(protocol)是通过UDP实现的。客户端需要超时,因此服务器需要保留与其通信的每个客户端的状态。 还假设使用了select。 实现多线程服务器总是最好的吗?我认为链接列表也会做同样
考虑一个非常短的程序,我在其中分配了一点内存。我被告知,GC 在程序分配大量内存并且分配达到限制的情况下运行。 我不知道这个限制到底是多少,但我认为它必须足够高,这样 GC 才不会频繁运行并减慢程序的
根据 Cocoa with Love当应用程序需要 WiFi(而不是蜂窝网络)时需要可达性,例如如果应用加载大量视频并且不适合在 3G 网络上使用。 我的应用程序使用互联网,无论是 WiFi 还是 3
我正在寻找更好的解决方案来解决我面临的这个问题。 如果您将鼠标悬停在缩略图上,它会淡出较大的镜头并淡入新的镜头,这很好,但是当转到目标缩略图并且您的鼠标再悬停一些时,它会更改为您的鼠标经过并拍摄的其他
启用 UAC 并使用管理帐户登录后,您将获得两个 token : 提升的 token ;这已启用 Administrators 组,具有高完整性(即强制性完整性标签 SID 为 S-1-16-1228
我想知道在 React 中创建动态选择组件的规范方法是什么。我是否必须创建一个单独的组件来根据下面的代码返回选项,以便能够通过每个条目的 props 自定义值,然后将它们包含到单独的选择组件中? p>
我有一个启用了分页的数据网格。我根据过滤条件在数据网格中显示结果。我已经过滤了数据,现在有 2 页。当我转到第二页时。我正在再次执行搜索功能以缩小结果范围。然后我收到类似“无效的 CurrentPag
我有原始文本列,其值类似于“2012-07-26T10:33:34”和“2012-07-26T10:56:16”。在使用 Joda-Time 的 Java 中,我可以通过调用 轻松地将其转换为日期/从
您好,我被分配了一项棘手的任务。我需要让一个方形 div 到达顶部的一个点。基本上它看起来像一个正方形 div,顶部有一个宽三 Angular 形。请参阅下面的屏幕截图。顶部的深蓝色只是堆叠在白色 d
我想知道,为什么我们在 android 中使用不同的启动器图标(大小)。目前您“必须”将图标大小调整为: LDPI - 36 x 36 MDPI - 48 x 48 HDPI - 72 x 72 XH
在 SO 的几个地方,声称必须知道对象的确切类型并基于此做出决定(以 if-then-else 方式)指向一个设计缺陷,例如here . 我想知道是否总是如此。在当前的一个小型教育项目(我正在使用它来
据我了解,迭代器是一种为客户端提供接口(interface)以观察/迭代/传递自定义集合等内容的机制,而不破坏信息隐藏原则。 STL 容器有自己的迭代器,所以我们可以毫无问题地对它们使用 for (
我在 Golang 中编写了一个包装函数,用于从多个文件中渲染模板,如下所示: func RenderTemplate(w http.ResponseWriter, data interface{},
据我了解,size_type 和 difference_type 的目的不仅仅是符号——它也是为了解决例如分段架构等,它们可能具有不同的大小。 在这种情况下,如果我有一个带有随机访问迭代器的容器,那么
我是一名优秀的程序员,十分优秀!