エントリーの編集

エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
ActiveModel::AttributeMethods::ClassMethods
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています

- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
ActiveModel::AttributeMethods::ClassMethods
Allows you to make aliases for attributes. class Person include ActiveModel::AttributeMethods att... Allows you to make aliases for attributes. class Person include ActiveModel::AttributeMethods attr_accessor :name attribute_method_suffix '_short?' define_attribute_methods :name alias_attribute :nickname, :name private def attribute_short?(attr) send(attr).length < 5 end end person = Person.new person.name = 'Bob' person.name # => "Bob" person.nickname # => "Bob" person.name_short? # => true pers