Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我创建一个 Rails 应用程序时,
安慰:
rails new foo
我的代码可以使用字符串“foo”吗?
puts "Your app's name is " + app_name_bar
Rails.application.class将为您提供应用程序的全名(例如 YourAppName::Application)。
Rails.application.class
从那里您可以使用Rails.application.class.parent.
Rails.application.class.parent