2

ActiveSupportインフレクタークラスを見つけました。英語のインフレクターを初期化するコードはどこにありますか?

4

2 に答える 2

1

ActiveSupport inflector.rbファイルには、すべての屈折ライブラリとモジュールが含まれています。

カスタマイズしたい場合inflections.rbは、Railsconfig/initializersパスに呼び出されるファイルがあります。

デフォルトでは含まれています

# Be sure to restart your server when you modify this file.

# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
#   inflect.plural /^(ox)$/i, '\1en'
#   inflect.singular /^(ox)en/i, '\1'
#   inflect.irregular 'person', 'people'
#   inflect.uncountable %w( fish sheep )
# end

これを編集して、Inflector動作をカスタマイズできます。

于 2010-12-14T14:01:56.507 に答える
0

英語のルールは ActiveSupport (具体的には lib/active_support/inflections.rb) にあります。

于 2010-12-14T14:01:55.777 に答える