- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我是 Rails 新手,正在按照他们网站上的入门指南进行操作。
当我在以下部分运行 $ rake db:migrate
时出现错误:http://guides.rubyonrails.org/getting_started.html#generating-a-model
它第一次在以下部分起作用:http://guides.rubyonrails.org/getting_started.html#running-a-migration
所以我不知道哪里出了问题。
当我运行 $ rake db:migrate
== CreateComments: migrating =================================================
-- create_table(:comments)
rake aborted!
An error has occurred, this and all later migrations canceled:
private method `test' called for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007f83a27503c8>
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
所以我按照说明使用 --trace
参数运行它;我想知道是否有人知道这意味着什么,问题是什么?
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
== CreateComments: migrating =================================================
-- create_table(:comments)
rake aborted!
An error has occurred, this and all later migrations canceled:
private method `test' called for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007f8bacbba730>
/Users/parnmatt/Sites/test-rails/blog/db/migrate/20120627130542_create_comments.rb:5:in `block in change'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/schema_statements.rb:160:in `create_table'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:466:in `block in method_missing'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:438:in `block in say_with_time'
/Users/parnmatt/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:438:in `say_with_time'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:458:in `method_missing'
/Users/parnmatt/Sites/test-rails/blog/db/migrate/20120627130542_create_comments.rb:3:in `change'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:407:in `block (2 levels) in migrate'
/Users/parnmatt/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:407:in `block in migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:123:in `with_connection'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:389:in `migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:528:in `migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in `call'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in `block in ddl_transaction'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/transactions.rb:208:in `transaction'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in `ddl_transaction'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:719:in `block in migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:700:in `each'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:700:in `migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:570:in `up'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:551:in `migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/railties/databases.rake:153:in `block (2 levels) in <top (required)>'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/parnmatt/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `load'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `<main>'
Tasks: TOP => db:migrate
这是生成的迁移代码:
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.string :commenter
t.test :body
t.references :post
t.timestamps
end
add_index :comments, :post_id
end
end
最佳答案
看起来当您运行生成器时,您说的是“测试”而不是“文本”作为正文。
应该是:$ rails generate model Comment commenter:string body:text post:references
Rake 不知道 t.test 是什么类型...应该是 t.text
关于ruby-on-rails - rails 3.2.6; rake 0.9.2.2;数据库 :migrate aborted,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11227284/
我正在尝试从数组元素中形成最大数。下面给出的我的实现在某些情况下工作正常,而在其他一些情况下它给出错误“来自 abort(3) (SIGABRT) 的中止信号”。为什么?帮帮我! #include
我见过许多具有如下所示的线程过程的示例。 private void ThreadProc() { while (serviceStarted) {
以下代码用于基本的循环链表,但是当一个人输入一个较大的n(例如8位数字)值时,它将引发“abort(3)(sigabrt)中止信号”错误。我不确定这意味着什么,并且希望就我的代码解决此问题提供一些指导
这个问题在这里已经有了答案: Why exactly should I not call free() on variables not allocated by malloc()? (7 个答案)
此文档页面在突出通知中指出,Delphi 中有两个中止指令。一种称为abort,另一种称为Abort。 http://docwiki.embarcadero.com/RADStudio/Tokyo/e
我正在尝试获取/构建V8,并且需要首先安装depot_Tools。在运行UPDATE_DEPOT_TOOLS时,我不断收到从错误开始的错误。而且我永远也想不出为什么/找不到调试底层GO代码的源代码。
我正在尝试获取/构建V8,并且需要首先安装depot_Tools。在运行UPDATE_DEPOT_TOOLS时,我不断收到从错误开始的错误。而且我永远也想不出为什么/找不到调试底层GO代码的源代码。
在索引数据库中升级数据库版本时出错。“请求被中止,例如通过调用 IDBTransaction.abort。” ConstraintError:事务中的变异操作失败,因为不满足约束。例如,对象存储或索引
我对C++编程不是很在行,但我真的解决不了这个问题。我的项目如下:使用TCP协议连接到WiFi服务器。服务器继续发送文本行:没问题。它系统地连接在一起。专用线程正在循环接收文本并将其显示在编辑窗口中。
每次用户输入内容时,我都会使用 $.get jquery 函数。我的函数如下所示 function checkField(va) { $.get( '/admin-tool',
这是我的代码,它接受一个整数 s 作为输入,它是我希望它处理的字符串数量,然后它接受 s 个字符串作为输入。对于它们中的每一个,它应该输出更大的字母字典排列,即最小的字母排列。问题是它编译得很好,但在
这个问题在这里已经有了答案: C++ terminate called without an active exception (6 个答案) 关闭 6 年前。 让我们谈谈下一个代码示例: #inc
如果输入字段的长度为空,我会尝试取消所有剩余的 AJAX 请求。但是,我看到这个错误: Uncaught TypeError: Cannot read property 'abort' of unde
代码(我的原始代码使用assert,但这是一个更短的sscce) #include int main() { abort(); return 0; } 编译器版本: $ g++ --
我有一个以前从未见过的东西的回溯。请参阅这些线程中的框架 2: Thread 31 (process 8752): #0 0x00faa410 in __kernel_vsyscall () #1
前言: 有时候,连接mysql的会话经常会异常退出,错误日志里会看到"got an error reading communication packets"类型的告警。本篇文章
我正在尝试调用C++ Java 中的方法编码。 我收到了Android NDK : Aborting. Stop当定义 Android.mk文件如下: LOCAL_PATH := $(call my-
这更多是出于个人好奇心/兴趣,而不是我试图解决的特定问题。 假设您有一个程序正在对用户提供的信息(例如搜索字符串)执行一些操作,这些信息会随着用户键入而改变。假设您想向用户显示与他们在任何给定时间输入
我们需要将我们的一些 UI 翻译成英文,问题出现了:我什么时候使用“Abort”,什么时候使用“Cancel”作为按钮文本?它们似乎可以互换,并且或多或少地翻译成德语(我们的来源)中的同一个词....
当使用从 jQuery.ajax 函数传回的 xhr 中止 ajax 请求时,firebug 显示它仍在尝试加载该请求。它不会阻止发出的任何更多请求,但也不会显示它曾经完成过请求。 这只是一个 Fir
我是一名优秀的程序员,十分优秀!