class Translates::ColumnBackend
Public Class Methods
new(model, attribute)
click to toggle source
# File lib/translates/column_backend.rb, line 3 def initialize(model, attribute) @model, @attribute = model, attribute end
setup_model(*)
click to toggle source
# File lib/translates/column_backend.rb, line 15 def self.setup_model(*) end
Public Instance Methods
read(locale)
click to toggle source
# File lib/translates/column_backend.rb, line 7 def read(locale) @model.read_attribute(column(locale)) end
write(locale, value)
click to toggle source
# File lib/translates/column_backend.rb, line 11 def write(locale, value) @model.write_attribute(column(locale), value) end
Private Instance Methods
column(locale)
click to toggle source
# File lib/translates/column_backend.rb, line 20 def column(locale) "#{@attribute}_#{locale.to_s.downcase.gsub('-', '_')}" end