Gregory Grimaux wrote in post #965148:
> 0 down vote favorite
>
>
> Hi, since several days I have this problem:
>
> For a few days it has worked and now I can't do it works again. I setup
> a rails server on ubuntu with apache-2. I used a git repository to get
> all new change. After I run
> sudo rake db:migrate RAILS_ENV=production

You shouldn't be using sudo for that.

>
> But after have restart apache server I can see that rails use the
> development db and not the production while before it has used it.

Then you have not set your RAILS_ENV environment variable correctly. 
You can usually do that in the Apache config file.

I assume you're using Passenger (and if not, you should).  If I remember 
correctly, there is info in the Passenger docs on how to do this.
>
> MORE INFO:
>    While I'm trying to understand the problem I note something: When I
> execute rake db:migrate RAILS_ENV=production I can see that it create me
> the production db.

Right, because RAILS_ENV=production puts you in the production 
environment -- for that task only.

> But if I add new value in db I can see it still used
> development. I'm continuing my search on google :D. But if someone knows
> the answer
>
> I don't really understand what can cause this. So i really appreciate
> some help.

Simple: as I explained above, environment variables are not being set 
correctly.  When you specify an environment variable on the command 
line, it is only used for that command.

Please gain a better understanding of how environment variable work in 
*nix.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to