[英]globalize2 problem
I have strange globalize2 problem. 我有一个奇怪的globalize2问题。 I'm trying to use globalize 2 and acts_as_textiled and acts_as_commentable. 我正在尝试使用global 2和acts_as_textiled和acts_as_commentable。 For example - lets we have Post model, that acts_as_commentable. 例如-让我们拥有Post模型,即act_as_commentable。 From console 从控制台
p = Post.find 1
c = p.comments.find 1
works fine, but in browser - nothing displayed 工作正常,但在浏览器中-无显示
Similar, when Post contains 类似,当帖子包含
acts_as_textiled :body
from console body is containing correct data, but in browser i see nothing :( 从控制台主体包含正确的数据,但在浏览器中我什么也没看到:(
Any ideas how to correct it? 任何想法如何纠正它?
Upd: "nothing displayed" means, that for code like Upd:“不显示任何内容”表示对于类似这样的代码
class Post < ActiveRecord::Base
translates :title, :body
acts_as_textiled :body
end
on access to Post.body i've got nil, but on disabled globalize2 or acts_as_textiled body returns his value. 在访问Post.body时我已经没有了,但是在禁用globalize2或acts_as_textiled时返回了他的值。 I've tried with different locales - the same result. 我尝试了不同的语言环境-相同的结果。
Have you performed the necessary migrations? 您是否进行了必要的迁移? For localised content you should remove the localised fields in the main table (posts) and create a table for the localisations, like this: 对于本地化内容,您应该删除主表(帖子)中的本地化字段,并为本地化创建一个表,如下所示:
create_table "post_translations", :force => true do |t|
t.string "locale"
t.integer "product_id"
t.string "title"
t.text "body"
end
Just guessing here :) 只是在这里猜测:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.