LoginSignup
0
0

More than 1 year has passed since last update.

Rails — ActiveModel::Conversion to_partial_path のパス生成 ( people/person ってどこから出てきたの? )

Last updated at Posted at 2018-10-17

この例

class Person
  include ActiveModel::Conversion
end

person = Person.new
person.to_partial_path # => "people/person"

peopleってどこから出てきたの?

他のクラスで試してみる

class Dog
  include ActiveModel::Conversion
end

person = Person.new
person.to_partial_path # => "dogs/dog"

Dog の場合は dogs/dog が生成された。

どうやら Person クラスの場合は、 person の複数形である people に変換 されているようだ。

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0