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)
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?
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.
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.
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 …
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).
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.
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.
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 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…!!
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 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.
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.