mongoid translate spec works
This commit is contained in:
parent
dace90ec93
commit
55d6b88de1
|
@ -2,11 +2,12 @@ module Ransack
|
|||
module Translate
|
||||
|
||||
def self.i18n_key(klass)
|
||||
if ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR == 0
|
||||
klass.model_name.i18n_key.to_s.tr('.', '/')
|
||||
else
|
||||
klass.model_name.i18n_key.to_s
|
||||
end
|
||||
# if ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR == 0
|
||||
# klass.model_name.i18n_key.to_s.tr('.', '/')
|
||||
# else
|
||||
# klass.model_name.i18n_key.to_s
|
||||
# end
|
||||
klass.model_name.i18n_key.to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
require 'mongoid_spec_helper'
|
||||
|
||||
module Ransack
|
||||
describe Translate do
|
||||
|
||||
describe '.attribute' do
|
||||
it 'translate namespaced attribute like AR does' do
|
||||
ar_translation = ::Namespace::Article.human_attribute_name(:title)
|
||||
ransack_translation = Ransack::Translate.attribute(:title, :context => ::Namespace::Article.search.context)
|
||||
expect(ransack_translation).to eq ar_translation
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue