我正在尝试为rails应用程序创建一个插件(fedena)rails版本是2.3.8。
在我的插件目录的db / migrate文件夹中创建了一个文件20140709100104_ultimo_theme.rb。
但是在安装插件时没有创建表。 我已经检查了它进入课堂但它没有进入函数self.up, 这是文件内容。
class UltimoTheme < ActiveRecord::Migration
def self.up
puts "creating table"
create_table :ultimo_theme do |t|
t.string :theme_name
t.boolean :is_current
t.timestamps
end
end
def self.down
drop_table :ultimo_theme
end
end
作为rails中的新手,不知道它。
---------- EDIT --------
运行时出错
rake db:migrate:up VERSION = 20140709100104 --trace
** Execute db:migrate:up
rake aborted!
No migration with version number 20140709100104
/var/lib/gems/1.9.1/gems/activerecord-2.3.18/lib/active_record/migration.rb:455:in `run'
/var/lib/gems/1.9.1/gems/activerecord-2.3.18/lib/active_record/migration.rb:409:in `run'
/var/lib/gems/1.9.1/gems/rails-2.3.18/lib/tasks/databases.rake:135:in `block (3 levels) in <top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/var/lib/gems/1.9.1/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19:in `<main>'
Tasks: TOP => db:migrate:up
答案 0 :(得分:0)
使用此rake命令
rake fedena:plugins:install_all