rails_env not working, apparently

690 kali dilihat
Langsung ke pesan pertama yang belum dibaca

Leandro N. Camargo

belum dibaca,
9 Nov 2009, 14.10.3609/11/09
kepadaPhusion Passenger Discussions
Well, everything is running fine with nginx and passenger on my
server.
The only problem is that I realized my rails app is not running as a
'staging' environment.

I put the "rails_env staging;" inside my server { } block and it
still runs as 'production' environment.

Any guess on this?

Thanks.

Elliot Temple

belum dibaca,
24 Nov 2009, 14.13.4424/11/09
kepadaPhusion Passenger Discussions
I am having the same problem. rails_env line is ignored.

I just installed passenger with nginx on snow leopard. I previously
had it working on PPC leopard, so I think my config file is good. On
the old computer I had passenger 2.2.4. Now I've got 2.2.7. I've got:

server {
listen 80;
server_name secrethostname.local;
root /Users/curi/stuff/public; # <--- be sure to point to
'public'!
passenger_enabled on;
rails_env development;
}

The only lines changed from my previous working config were:

passenger_root /Library/Ruby/Gems/1.8/gems/passenger-2.2.7/;
passenger_ruby /usr/bin/ruby;

and

user curi staff;

I had to specify the "staff" group instead of leaving group
unspecified. Looked like my old computer had a group named after my
username, which was being used by default, and now snow leopard
doesn't have that.

So, it ignores the rails_env line and tries to connect to the
production database server. Any help?

Elliot Temple

belum dibaca,
24 Nov 2009, 14.27.3924/11/09
kepadaPhusion Passenger Discussions


On Nov 9, 11:10 am, "Leandro N. Camargo" <leandro...@gmail.com> wrote:
> Well, everything is running fine with nginx and passenger on my
> server.
> The only problem is that I realized my rails app is not running as a
> 'staging' environment.
>
> I put the "rails_envstaging;" inside my server {  } block and it
> still runs as 'production' environment.
>
> Any guess on this?

I wrote a reply with the same problem that doesn't seem to have
appeared yet. But anyway I found a fix. Add this at the top of your
config.ru

ENV['RAILS_ENV'] = ENV['RACK_ENV'] if !ENV['RAILS_ENV'] && ENV
['RACK_ENV']

If anyone knows a better way, please let me know!
Balas ke semua
Balas ke penulis
Teruskan
0 pesan baru