Home>

When reading the source code of the GEM called Sorcery, the following description isOptionsI did not know where it was defined, so I would like to ask for a question to Ruby.

[: model]Since there was a KEY designation, OPTIONS thought that it was a variable, but the variable of options in the scope was not found. Since there is an options called options for Rails, are you pointing? I thought but I do not know

Def model_class_name
        Options [: model]? Options [: model] .Classify: 'user'
      END

  • Answer # 1

    SORCERY :: GENERATORS :: HelpersModuleSorcery :: Generators :: InstallGeneratorin CLASSincludeNot used in the form and only in the form. This InstallGenerator ClassRails :: Generators :: BaseInheriting Class. andRails :: Generators :: BaseIs an instance methodOptionsHere, becauseOptionsIs defined.

    RAILS :: Generators :: BaseNSOptionsYou can see from the following.

    Well, if you follow the inheritance tree, you are inheriting Thor. I deepened my understanding. thank you very much!

    mzmt2021-09-15 22:13:48

    As we summarize in articles, it is fortunate if there is a difference that is different zenn.dev/mz/articles/3b442c047e0423

    mzmt2021-09-15 22:13:48