1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Ruby] 予約語

Posted at

Image from Gyazo

予約語はクラス名、変数名などに用いることはできません。
ただし接頭辞$, @、@@が先頭についたものは予約語とは見なされません。
また、def のあとやメソッド呼び出しのピリオドのあとなど、メソッド名であるとはっきり分かる場所ではメソッド名として用いることができます。

参照
Ruby 3.0.0 リファレンスマニュアル


最近、rails g model func
でfuncモデルを作成しようとしたところ、失敗しました。
エラーメッセージは下記です。
Image from Gyazo

仮説検証は行っていないのですが、別サイトに「予約語: Function」とあったことと
別名に変更すると解決したのでおそらくこれが原因です。

知識は毎日増やしていきます。

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?