Running in non-dev envs. with script/runner shebang setup


I have a script that runs script/runner via the shebang mechanism at the
top o the file, like so:

#!/usr/bin/env ./script/runner

This works fine in development, how would I get it to run in
non-development environments?


$ script/runner -h

Usage: script/runner [options] (‘Some.ruby(code)’ or a filename)

 -e, --environment=name           Specifies the environment for

the runner to operate under (test/development/production).
Default: development

 -h, --help                       Show this help message.


The -e option is probably what you are looking for.

That’s correct, but I can’t get it to work when the script/runner
command is in a file, like so:


#!/usr/bin/env ./script/runner -e production

If I run import_physicians.rb, this doesn’t work.



RAILS_ENV=production lib/import_physicians.rb

works fine.


Im trying to see posts index page, In tat im showing category list,
using collect method it show error…

ActiveRecord::StatementInvalid in Posts#index
Showing app/views/posts/index.html.erb where line #19 raised:

Mysql::Error: Unknown column ‘categories_posts.category_id’ in ‘on
clause’: SELECT categories.* FROM categories INNER JOIN
categories_posts ON =
categories_posts.category_id WHERE ((categories_posts.post_id


Extracted source (around line #19):


<%= post.created_at.strftime(’%m/%d/%y %I:%m %p’) %>
17: <%= h(post.title) %>
18: <%= h( if %>
19: <%= post.categories.collect {|cat| [] }.join(",")
20: <%= h(post.status) %>
21: <%= post.comments_count %>

pls help me, im new to RoR…??

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs