Cannot connect to local host

I made a mistake last time and shut down my RoR project without pushing
to git or anything. I just tried to log back in and I can’t connect to
the local when I start rails server. This is the error I’m getting - I
tried to rollback rake to fix it, but didn’t work.

Any other ideas? I’m pretty much a total beginner and have no idea.

NameError: undefined local variable or method place' for main:Object /Users/fatima/Desktop/floo/app/admin/[place].rb:1:in<top (required)>’
/usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in
load' /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:inblock in load’
/usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in
load_dependency' /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:inload’
/usr/local/rvm/gems/ruby-2.1.1/bundler/gems/active_admin-2ae0a9e09bf9/lib/active_admin/application.rb:179:in
block in load' /usr/local/rvm/gems/ruby-2.1.1/bundler/gems/active_admin-2ae0a9e09bf9/lib/active_admin/error.rb:23:incapture’
/usr/local/rvm/gems/ruby-2.1.1/bundler/gems/active_admin-2ae0a9e09bf9/lib/active_admin/application.rb:179:in
load' /usr/local/rvm/gems/ruby-2.1.1/bundler/gems/active_admin-2ae0a9e09bf9/lib/active_admin/application.rb:171:inblock in load!’
/usr/local/rvm/gems/ruby-2.1.1/bundler/gems/active_admin-2ae0a9e09bf9/lib/active_admin/application.rb:171:in
each' /usr/local/rvm/gems/ruby-2.1.1/bundler/gems/active_admin-2ae0a9e09bf9/lib/active_admin/application.rb:171:inload!’
/usr/local/rvm/gems/ruby-2.1.1/bundler/gems/active_admin-2ae0a9e09bf9/lib/active_admin/application.rb:193:in
routes' /usr/local/rvm/gems/ruby-2.1.1/bundler/gems/active_admin-2ae0a9e09bf9/lib/active_admin.rb:80:inroutes’
/Users/fatima/Desktop/floo/config/routes.rb:4:in block in <top (required)>' /usr/local/rvm/gems/ruby-2.1.1/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:335:ininstance_exec’
/usr/local/rvm/gems/ruby-2.1.1/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:335:in
eval_block' /usr/local/rvm/gems/ruby-2.1.1/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:313:indraw’
/Users/fatima/Desktop/floo/config/routes.rb:1:in <top (required)>' /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:inload’
/usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in
block in load' /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:inload_dependency’
/usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in
load' /usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:inblock in load_paths’
/usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:in
each' /usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:inload_paths’
/usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:16:in
reload!' /usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:26:inblock in updater’
/usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/file_update_checker.rb:75:in
call' /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/file_update_checker.rb:75:inexecute’
/usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:27:in
updater' /usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:7:inexecute_if_updated’
/usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/finisher.rb:71:in
block in <module:Finisher>' /usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/initializable.rb:30:ininstance_exec’
/usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/initializable.rb:30:in
run' /usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/initializable.rb:55:inblock in run_initializers’
/usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/initializable.rb:54:in
run_initializers' /usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application.rb:288:ininitialize!’
/Users/fatima/Desktop/floo/config/environment.rb:5:in <top (required)>' /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:inrequire’
/usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in
block in require' /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:inload_dependency’
/usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in
require' /usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application.rb:264:inrequire_environment!’
/usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application.rb:367:in
block in run_tasks_blocks' /usr/local/rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:ineval’
/usr/local/rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `’
Tasks: TOP => db:rollback => environment
(See full trace by running task with --trace)

On 13 July 2014 23:03, Fatima F. [email protected] wrote:

I made a mistake last time and shut down my RoR project without pushing
to git or anything. I just tried to log back in and I can’t connect to
the local when I start rails server. This is the error I’m getting - I
tried to rollback rake to fix it, but didn’t work.

Shutting down a server should not stop it restarting successfully,
provided you had not changed the source files or environment in some
way.

Any other ideas? I’m pretty much a total beginner and have no idea.

NameError: undefined local variable or method place' for main:Object ... /Users/fatima/Desktop/floo/config/routes.rb:1:in <top (required)>’

I don’t know that it will help, but what is in that line?

Colin

Hi,

Have you try deleting the Gemfile.lock and then run bundle install
and
then finally rails s… hope this will help you…

:slight_smile:

On 14 July 2014 13:14, Rasool SB [email protected] wrote:

Hi,

Have you try deleting the Gemfile.lock and then run bundle install and
then finally rails s… hope this will help you…

Why delete Gemfile.lock when the system was previously working?
Gemfile.lock is what ensures the same versions of gems are used as was
previously working.

Colin

On Sun, Jul 13, 2014 at 3:03 PM, Fatima F. [email protected]
wrote:

I made a mistake last time and shut down my RoR project without pushing
to git or anything.

That sentence doesn’t really make sense.

Are you using git at all? If so, stash your changes and check out
the last known working version, confirm it works, then start adding
back the changes you made.

Alternatively, of if you’re not using git, run your tests. That should
help pin down the problem (or you need more/better tests).

Given the references to routes.rb in the stack trace, can you run
rake routes? That might be illuminating.

NameError: undefined local variable or method `place’

If none of that helps, then I would grep the app for all mentions
of “place” and examine them for syntax errors, typos, etc.

Good luck,

Hassan S. ------------------------ [email protected]

twitter: @hassan

On Mon, Jul 14, 2014 at 8:19 AM, Fatima F. [email protected]
wrote:

  1. I get this error whenever I start rails server - nothing will
    connect to local host to show me errors/the site.

Irrelevant - the error messages are in your console/logs.

a.  This means I can't run rake routes - my rake commands are always

aborted and I get the same error message pasted above. I tried to
rollback rake as well, which is what I believe caused the issue. I
installed active admin and then tried to put my place scaffold within
it.

I don’t really follow that, but …

  1. If I delete the gemfile lock version, then what will happen? Will I
    be able to get it back? Will I need it for a future purpose?

I don’t see the point of that at all, but of course you can always
retrieve it from the previous git commit (assuming it was in a
previous commit).

  1. I am using git. Would I be able to revert to a past git commit
    even if my local host is not connecting?

Of course. Git functions are totally independent of your app. I’d
recommend taking a little time to learn more about using git, tbh.

And get in the habit of frequent small commits :slight_smile:

Good luck,

Hassan S. ------------------------ [email protected]

twitter: @hassan

Thanks for the help Rasool, Colin and Hassan.

  1. I get this error whenever I start rails server - nothing will
    connect to local host to show me errors/the site.
    a. This means I can’t run rake routes - my rake commands are always
    aborted and I get the same error message pasted above. I tried to
    rollback rake as well, which is what I believe caused the issue. I
    installed active admin and then tried to put my place scaffold within
    it.

  2. If I delete the gemfile lock version, then what will happen? Will I
    be able to get it back? Will I need it for a future purpose?

  3. I am using git. Would I be able to revert to a past git commit
    even if my local host is not connecting?

I will try looking for the “place” syntax error to see if that helps.

Gemfile.lock is a list of gems used to ensure that all copies of the app
use the same gem versions
*, *When ever we accidentally shutdown, Rails or Ruby files(
temporary
files) like "/tmp/pids/server.pid " and or “Gemfile.lock” caches logs to
interact with some methods, classes etc., due to sudden close of the
application when we try to run “rails s” it checks your gemfile.lock to
load the gems in to your environment, so the Gemfile.lock can’t give
right
information due to sudden close.
By deleting the Gemfile.lock wont harm anything (it’s kind of temp
file) by running “bundle install” you will get the “Gemfile.lock” file
automatically when the bundle install finishes. (NOTE: PLEASE DO NOT
DELETE
GEMFILE ACCIDENTALLY)
So the Gemfile will be fresh so the application can get right
information to start the application. Give a try…!!

Thanks for the suggestions all. I’m going to play around using the
feedback and let you know what I come to.

On Mon, Jul 14, 2014 at 9:06 AM, Rasool SB [email protected] wrote:

When ever we accidentally shutdown, Rails or Ruby files( temporary

files) like "/tmp/pids/server.pid " and or “Gemfile.lock” caches logs to
interact with some methods, classes etc., due to sudden close of the
application when we try to run “rails s” it checks your gemfile.lock to load
the gems in to your environment, so the Gemfile.lock can’t give right
information due to sudden close.

WAT?? If a Gemfile.lock was changed at runtime, it would show up in
a git status after every invocation of the server. So – no.

By deleting the Gemfile.lock wont harm anything (it's kind of temp file)

by running “bundle install” you will get the “Gemfile.lock” file
automatically when the bundle install finishes.

It’s in no way a “kind of temp file”.

Yes, you’ll get a new Gemfile.lock running bundle install, but it
won’t
necessarily match the previous one unless you have explicit versions
set for each gem in the Gemfile.

Deleting Gemfile.lock and re-bundling is a great way to muddy the
water when your app is already broken. Why would you want that?


Hassan S. ------------------------ [email protected]

twitter: @hassan

Thanks Eric - will try that!

Hassan is right. I doubt the problem is with your Gemfile.lock so I
suggest
starting elsewhere and leaving it alone.

The best thing would be to stash your changes using git and going back
to a
working version of the application. Go back to the last version that
worked
and see what’s different. Alternatively you can keep your current
changes
and just figure out what is happening with `place’. Search your files
and
make sure that everything is fine around that variable. It’s clear the
problem is with that so make sure that every instance of that variable
is
working and that should fix the problem that appears with the imports as
well.

You should check the file mentioned in the first line of stacktrace or
show it to us

Thanks for the help everybody. I wasn’t able to fix the file, but I
just ended up deleting the entire place file and had to fix some jquery
modules according to what I found on SO. I will just try to start over
and put it under active admin.