Ruby on rails 3 在自己的标记实现后执行ActsAsTaggableOn
我在rails应用程序中有自己的标记实现,并希望用ActsAsTaggableOn gem替换它。我生成了迁移并删除了所有带有标记的迁移,但是忘记了首先回滚,所以我只做了rake db:reset。现在,模式中有tag和taggable看起来不错,但是如果我在控制台中尝试使用tag,只需键入tag我就可以得到Ruby on rails 3 在自己的标记实现后执行ActsAsTaggableOn,ruby-on-rails-3,tags,acts-as-taggable-on,Ruby On Rails 3,Tags,Acts As Taggable On,我在rails应用程序中有自己的标记实现,并希望用ActsAsTaggableOn gem替换它。我生成了迁移并删除了所有带有标记的迁移,但是忘记了首先回滚,所以我只做了rake db:reset。现在,模式中有tag和taggable看起来不错,但是如果我在控制台中尝试使用tag,只需键入tag我就可以得到 NameError: uninitialized constant Tag 是什么导致了这个错误,我想我只是喜欢上了 My schema.rb如下所示: # encoding: UTF-
NameError: uninitialized constant Tag
是什么导致了这个错误,我想我只是喜欢上了
My schema.rb如下所示:
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20121009203921) do
create_table "comments", :force => true do |t|
t.text "content"
t.integer "user_id"
t.integer "message_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "events", :force => true do |t|
t.string "name"
t.datetime "start_at"
t.datetime "end_at"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "messages", :force => true do |t|
t.text "content"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "taggings", :force => true do |t|
t.integer "tag_id"
t.integer "taggable_id"
t.string "taggable_type"
t.integer "tagger_id"
t.string "tagger_type"
t.string "context", :limit => 128
t.datetime "created_at"
end
add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
create_table "tags", :force => true do |t|
t.string "name"
end
create_table "users", :force => true do |t|
t.string "name"
t.string "email"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "encrypted_password"
t.string "salt"
t.boolean "admin", :default => false
t.string "phone"
t.string "street"
t.string "zip"
t.string "location"
end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
end
谢谢你的帮助 我必须有一个模型,才能在控制台中工作