您好我跟着Sunil tutorial,但我收到了以下数据库错误:
Completed 500 Internal Server Error in 11.2ms
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
Processing by Refinery::PagesController#home as HTML
Parameters: {"locale"=>:es}
SELECT a.attname, format_type(a.atttypid, a.atttypmod),
ActionView::Template::Error (PG::UndefinedTable: ERROR:
relation "refinery_project_translations" does not exist
2014-12-29T14:14:46.684169+00:00 app[web.1]:
LINE 5: WHERE a.attrelid = '"refinery_project_translati...
2014-12-29T14:14:46.684177+00:00 app[web.1]:
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
迁移文件:
class CreateProjectTranslations < ActiveRecord::Migration
def up
::Refinery::Projects::Project.create_translation_table!({:description => :string},
:migrate_data => true)
remove_column :refinery_projects, :description
end
def self.down
add_column :refinery_projects, :description, :string
::Refinery::Projects::Project.drop_translation_table! :migrate_data => true
end
end
运行迁移后,我意识到不是没有为项目创建转换表。
型号:
module Refinery
module Projects
class Project < Refinery::Core::BaseModel
self.table_name = 'refinery_projects'
translates :description
attr_accessible :name, :description, :date_started, :date_conclusion,
:position, :relevance, :img_id, :project_id, :status
validates :name, :presence => true, :uniqueness => true
has_many :project_images
has_many_page_images
class Translation
attr_accessible :locale
end
end
end
end
我在这里失踪了什么?
答案 0 :(得分:0)
我解决了将迁移文件从扩展程序迁移到app migration文件夹的问题。之后,应用程序能够创建翻译表。
答案 1 :(得分:0)
以下是生成扩展程序的命令。如果要在现有文件上使用它,它将通过覆盖它们将所有必需的代码添加到现有文件中。小心一点 - 之前提交文件。
google-site-verification=<the token I was given>