Skip to content

Instantly share code, notes, and snippets.

@dallarosa
Created August 28, 2012 16:20
Show Gist options
  • Save dallarosa/3499849 to your computer and use it in GitHub Desktop.
Save dallarosa/3499849 to your computer and use it in GitHub Desktop.
class News < ActiveRecord::Base
include Translation::Google
attr_accessible :date, :description, :link, :title, :language
has_many :translations
def after_save
Translation.create({news_id: self.id, description:translate(self.description, self.language, "ja"), title: translate(self.title, self.language, "ja"), language: "ja" })
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment