我怎样才能复数兴趣点?
so that PointOfInterest
become PointsOfInterest
, point_of_interest
should becomepoints_of_interest
等等。
我怎样才能复数兴趣点?
so that PointOfInterest
become PointsOfInterest
, point_of_interest
should becomepoints_of_interest
等等。
您可以通过这种方式覆盖复数:
在config/initializers/inflections.rb
ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'PointOfInterest', 'PointsOfInterest'
inflect.irregular 'point_of_interest', 'points_of_interest'
end
从以前的答案:
更改 ActiveRecord 中的变形:
https://stackoverflow.com/a/3378349/1335244
http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html
直接编辑迁移: