在Rails中复用“兴趣点”

时间:2012-06-25 20:08:46

标签: ruby-on-rails ruby-on-rails-3 inflection

如何复制兴趣点

因此PointOfInterest变为PointsOfInterestpoint_of_interest应变为points_of_interest,依此类推。

2 个答案:

答案 0 :(得分:2)

您可以通过以下方式覆盖复数:

config/initializers/inflections.rb

ActiveSupport::Inflector.inflections do |inflect|
  inflect.irregular 'PointOfInterest', 'PointsOfInterest'
  inflect.irregular 'point_of_interest', 'points_of_interest'
end

另请参阅 Change plural form of generated model in rails?

答案 1 :(得分:0)