Ruby on rails 多元化';兴趣点';在轨

Ruby on rails 多元化';兴趣点';在轨,ruby-on-rails,ruby-on-rails-3,inflection,Ruby On Rails,Ruby On Rails 3,Inflection,如何使兴趣点多元化 因此,兴趣点变成兴趣点,兴趣点应该变成兴趣点,依此类推。从前面的答案: 更改ActiveRecord中的屈折变化: 直接编辑迁移: 您可以通过以下方式覆盖复数: 在config/initializers/definctions.rb中 ActiveSupport::Inflector.inflections do |inflect| inflect.irregular 'PointOfInterest', 'PointsOfInterest' inflect.ir

如何使兴趣点多元化

因此,
兴趣点
变成
兴趣点
兴趣点
应该变成
兴趣点
,依此类推。

从前面的答案:

更改ActiveRecord中的屈折变化:

直接编辑迁移:


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

config/initializers/definctions.rb中

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

另请参见

也许称之为“兴趣点”?是的,我认为Rails没有足够的NLP来知道这一点应该是多元的。我同意@AndrewC并说改名。@AndrewC我也有这个想法,但老板不希望这样。除非我说服他,否则就必须是这样。我可以发誓我已经试过了,但它似乎成功了。希望你不介意我在给你答案之前再胡乱琢磨一下。我在我的routes.rb中调用了“resources:points\u of theu interest”,它仍然定义“points\u of theu interest\u index\u url”而不是“point\u of theu interest\u url”。