I am trying to execute phantom.js module from rails. So far I've successfully installed the binary and the path for phantomjs seems to be working fine.

However when I try to run it from a rails app using backtick (for example: phantomjs rasterize.js <http://google.com> 1.jpg), it says No such file or directory.

I think the reason is it can't find the path for rasterize.js 
I tried putting the rasterize.js file in #{Rails.root}, inside public folder, inside controller folder but nothing works.

How can I solve this problem?

====

UPDATE: To clarify, i'm posting which code works inside my controller and which doesn't.

```
def create
  'phantomjs'
end

```

<= Above code doesn't spit out path error, and when I send a request from the browser, phantomjs process *does* get invoked, resulting in opening up the console in the server side.

```
def create
  'phantomjs rasterize.js'
end

```

<= This doesn't work, and it spits out error saying "No such file or directory", and that's why I think it has to do with rails not being able to find rasterize.js's path. I tried putting rasterize.js inside public folder, inside controllers folder, and inside the main directory: #{Rails.root}, but it's always the same.