`rails s -e production` loads development database not production

36 views
Skip to first unread message

Jiajia Wang

unread,
Jan 20, 2015, 11:56:33 PM1/20/15
to rubyonra...@googlegroups.com
I'm running into a very weird rails server problem.

I started a rails application in production mode with `rails s -e
produciton` and got some db errors when visiting the site.

Then I realised that it loaded development database not production
database.

To confirm that, I removed development db config from database.yml.

Then I got
$ bundle exec rails s -e production
Digest::Digest is deprecated; use Digest
=> Booting Thin
=> Rails 4.1.6 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider
using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Digest::Digest is deprecated; use Digest
Exiting
/home/ubuntu/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.6/lib/active_record/connection_adapters/connection_specification.rb:257:in
`resolve_symbol_connection': 'development' database is not configured.
Available: ["production", "test"] (ActiveRecord::AdapterNotSpecified)

What happened here?

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

Colin Law

unread,
Jan 21, 2015, 3:05:19 AM1/21/15
to rubyonra...@googlegroups.com
On 21 January 2015 at 04:55, Jiajia Wang <li...@ruby-forum.com> wrote:
> I'm running into a very weird rails server problem.
>
> I started a rails application in production mode with `rails s -e
> produciton` and got some db errors when visiting the site.
>
> Then I realised that it loaded development database not production
> database.
>
> To confirm that, I removed development db config from database.yml.
>
> Then I got
> $ bundle exec rails s -e production
> Digest::Digest is deprecated; use Digest

I don't immediately see why it would be relevant but I would sort the
above problem first. It likely means you are using an out of date
gem. My principle after decades of tracking down software issues is
always to sort problems that should be easily sortable before worrying
about more esoteric problems.

Colin

Mads Ohm Larsen

unread,
Jan 21, 2015, 4:14:34 PM1/21/15
to rubyonra...@googlegroups.com
Jiajia Wang wrote in post #1166961:
> I'm running into a very weird rails server problem.
>
> I started a rails application in production mode with `rails s -e
> produciton` and got some db errors when visiting the site.

Have you tried with

$ RAILS_ENV=production bundle exec rails s

instead? Does this yield different results?

Rob Biedenharn

unread,
Jan 21, 2015, 4:38:55 PM1/21/15
to rubyonra...@googlegroups.com

On 2015-Jan-21, at 16:13 , Mads Ohm Larsen <li...@ruby-forum.com> wrote:

> Jiajia Wang wrote in post #1166961:
>> I'm running into a very weird rails server problem.
>>
>> I started a rails application in production mode with `rails s -e
>> produciton` and got some db errors when visiting the site.

Did you cut-n-paste that command?
Because you have misspelt produciton (swapped i and t)

-Rob

> Have you tried with
>
> $ RAILS_ENV=production bundle exec rails s
>
> instead? Does this yield different results?
>
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e52704beaba5557a2a789579dd8dd2f4%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.

Jiajia Wang

unread,
Jan 21, 2015, 5:23:27 PM1/21/15
to rubyonra...@googlegroups.com
Mads Ohm Larsen wrote in post #1167041:
> Jiajia Wang wrote in post #1166961:
>> I'm running into a very weird rails server problem.
>>
>> I started a rails application in production mode with `rails s -e
>> produciton` and got some db errors when visiting the site.
>
> Have you tried with
>
> $ RAILS_ENV=production bundle exec rails s
>
> instead? Does this yield different results?

Yes, I tried.

It gave the same result.

Jiajia Wang

unread,
Jan 21, 2015, 5:24:50 PM1/21/15
to rubyonra...@googlegroups.com
Rob Biedenharn wrote in post #1167042:
> On 2015-Jan-21, at 16:13 , Mads Ohm Larsen <li...@ruby-forum.com> wrote:
>
>> Jiajia Wang wrote in post #1166961:
>>> I'm running into a very weird rails server problem.
>>>
>>> I started a rails application in production mode with `rails s -e
>>> produciton` and got some db errors when visiting the site.
>
> Did you cut-n-paste that command?
> Because you have misspelt produciton (swapped i and t)
>
> -Rob

That's a typo.

Jiajia Wang

unread,
Jan 21, 2015, 6:16:23 PM1/21/15
to rubyonra...@googlegroups.com
Jiajia Wang wrote in post #1166961:
Figured out what the problem was.

Found this line in initializers/session_store.rb
ActiveRecord::SessionStore::Session.establish_connection(:development)

Removing it and changing session store to use :cookie_store solved the
problem.
Reply all
Reply to author
Forward
0 new messages