⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 06 - understanding pluralization rules.rb

📁 O Reilly Ruby Cookbook source code
💻 RB
字号:
class Order < ActiveRecord::Base  has_many :line_itemsend#---Rails::Initializer.run do |config|  config.active_record.pluralize_table_names = falseend#---Inflector.inflections do |inflect|  inflect.plural /^(foo)$/i, '\1ze'  inflect.singular /^(foo)ze/i, '\1'end#---Inflector.inflections do |inflect|  inflect.irregular 'foo', 'fooze'end#---Inflector.inflections do |inflect|  inflect.uncountable ['status', 'furniture', 'fish', 'sheep']end#---require 'rubygems'require 'active_support/core_ext''blob'.pluralize                                 # => "blobs"'child'.pluralize                                # => "children"'octopus'.pluralize                              # => "octopi"'octopi'.singularize                             # => "octopus"'people'.singularize                             # => "person"'goose'.pluralize                                # => "gooses"Inflector.inflections { |i| i.irregular 'goose', 'geese' }'goose'.pluralize                                # => "geese"'moose'.pluralize                                # => "mooses"Inflector.inflections { |i| i.uncountable 'moose' }'moose'.pluralize                                # => "moose"#---

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -