Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is an application's name available as a variable?

When I create a rails application,

console:

rails new foo

Is the string "foo" available to my code?

puts "Your app's name is " + app_name_bar
like image 389
Starkers Avatar asked Oct 12 '13 12:10

Starkers


1 Answers

Rails.application.class will get you the full name of the application (eg. YourAppName::Application).

From there you can get the module name with Rails.application.class.parent.

like image 180
sevenseacat Avatar answered Sep 26 '22 01:09

sevenseacat