Ruby on Rails Plural Model Name

后端 未结 3 958
我寻月下人不归
我寻月下人不归 2021-01-01 12:44

I have a domain model that represents flight rules. Flight rules are a collection of regulations under which a flight is performed. Visual Flight Rules, or VFR is one such e

相关标签:
3条回答
  • 2021-01-01 13:15

    Try this

    rails generate scaffold FlightRules (...) --force-plural
    

    You can get the help on the generator with:

    rails g scaffold -h
    
    0 讨论(0)
  • 2021-01-01 13:18

    ActiveSupport::Inflector::Inflections is your friend.

    There is a file config/initializers/inflections.rb, which you can edit. The file contains commented examples, so it should be easy to add your own rules.

    0 讨论(0)
  • 2021-01-01 13:32

    You have to edit your inflections.rb file under config/initializers/inflections.rb

    ActiveSupport::Inflector.inflections do |inflect|
      inflect.uncountable %w(flight_rules)
    end
    
    0 讨论(0)
提交回复
热议问题