After some operations I would like to create the app from the script,
but when I try something like
rails"#{ARGV}"
where ARGV = name_app-d mysql
creates the app with a name like name_app-dmysql.
How can I pass ARGV to successfully create the app?
Thank you
Have you looked at what #{ARGV} evaluates to? The default to_s on
arrays just concatenates the elements, whereas you want to have a
space between them which join will do. On top of that you’ve put "
round that which will tell the shell ‘all this should be one argument’.
I tried different forms, including with join. My real mistake was that I
was using the notation ``
There’s nothing wrong with using ``, except that you’re quoting rather
excessively
rails #{ARGV.join(' ')}
is fine, as is
system(“rails #{ARGV.join(’ ')}”)
but "rails ..." isn’t. `` is already a quoting operator so you don’t
need the quotes (which makes the shell believe you want to run a
command called “rails -d mysql some_app” (ie it will look for
something whose filename is that whole string) whereas you want to run
a command called “rails” but passing those arguments.