Globalize2 Get only translated attributes from model
class Site < ActiveRecord::Base
translates :title, :content
attr_accessor :rank
end
How I can list only the attributes of the Site model, which work with the tr开发者_开发技巧anslates method ? (in this case, I should get an array with ['title', 'content'], without the rank attribute, because it is not translated.
The translations are stored in a separate table, accessible through the association globalize_translations
So, to get those, just do a
Site.first.globalize_translations
Then you will have to filter out the non-translated columns like id, site_id, locale, created_at, updated_at
the remaining ones should be the ones that you have translated.
If what you want is to get which attributes that are being translated and not the contents of it, then you can find them in the globalize_options: Site.globalize_options[:translated_attributes]
精彩评论